math

Help with this issue

My application allows rotating points around a center based on the mouse position. I'm basically rotating points around another point like this: void CGlEngineFunctions::RotateAroundPointRad( const POINTFLOAT &center, const POINTFLOAT &in, POINTFLOAT &out, float angle ) { //x' = cos(theta)*x - sin(theta)*y //y' = sin(theta)*x + cos(th...

What is the number equivalent to 1e100 ?

What is the number equivalent to 1e100 ? And what is the reason behind it ? Can anybody explain it better ? ...

How to make 100 divided by 110 equal a decimal in Java / Android

I'm trying to use the follow code to produce a decimal number, but the evaluation of l divided by h (low by high) always comes out to be 0. How can I correct this? Thanks! EditText marketValLow = (EditText) findViewById(R.id.marketValLow); EditText marketValHigh = (EditText) findViewById(R.id.marketValHigh); Str...

Calculate resulting RGB from 2 colors, one is transparent

I'm looking for a formula to convert them. I know to convert a general transparency it is alpha * new + ( 1 - alpha ) * old I have: Color A : RGB( 85, 113, 135 ) Color B : RGB( 43, 169, 225 ) Color A has 90% opacity and is laid on top of Color B, resulting in Color C : RGB( 65, 119, 145 ) My question is, how does it get Color C...

How to implement floor, ceil and round in LLVM bitcode?

Good day overflowers. I'm writing the math functions for a small LLVM-based programming language, and I'm currenly stumped by how to implement the common rounding fuctions floor, ceil and round (to even). Firstly because i haven't found any algorithm descriptions for these functions, secondly because I'm not familiar with what capabilit...

Popularity formula (using votes and age)

I need to create a simple formula for determining the popularity of an item based on votes and age. Here is my current formula, which needs some work: 30 / (days between post date and now) * (vote count) = weighted vote Whenever a vost is cast for an item it checks if its weighted vote is > 300. If an item has a weighted vote more than...

How to get a specific sequence like this?

There are 100 numbers: 1,1,2,2,3,3,...,50,50 How can I get a sequence which has 1 number between two 1s, and two numbers between two 2s, three numbers between two 3s,..., and fifty numbers between two 50s using the 100 numbers? Does anyone have a better idea than Bruteforce? Or prove it there's no solution when n = 50. Thanks. ...

Create an optimal grid based on n-items, total area, and H:W ratio

I'm creating an application that takes a number of equally sized rectangles and positions them in a grid on the screen. I have most of the logic complete for resizing and centering a rectangle within a cell but I'm having trouble with the actual portion that defines the grid the rectangles must conform to. Ideally, in the end I'd have a...

Multivariate Bisection Method

I need an algorithm to perform a 2D bisection method for solving a 2x2 non-linear problem. Example: two equations f(x,y)=0 and g(x,y)=0 which I want to solve somultaneously. I have very familiar with the 1D bisection ( as well as other numerical methods ). Assume I already know the solution lies between the bounds x1 < x < x2 and y1 < y ...

(C#) Conditional Formatting on Grid Column Based on Value Range

I found a great c# example that colors cells in different shades of orange based on the how large or small the value is: http://demos.devexpress.com/ASPxTreeListDemos/Appearance/ConditionalFormatting.aspx The problem is that it expects the numbers to be very large for it to work. Is there a way using a math formula that I could specify ...

Using a (mathematical) vector in a std::map

Related: what can I use as std::map keys? I needed to create a mapping where specific key locations in space map to lists of objects. std::map seemed the way to do it. So I'm keying a std::map on an xyz Vector class Vector { float x,y,z } ; , and I'm making a std::map<Vector, std::vector<Object*> >. So note the key here is not ...

Awk array assistance needed - averaging.

Here is an example of the type of data that I am trying to manipulate: 1213954013615]: 992 1213954013615]: 993 1213954013615]: 994 1213954013615]: 995 1213954013615]: 995 1213954013615]: 996 1213954013615]: 996 1213954013615]: 996 1213954013615]: 998 1213954247424]: 100 1213954247424]: 1002 1213954247424]: 1007 1213954303390]: 111 12139...

Question about the implementation of Bezier Curves?

Hello all, I have read some tutorials for bezier curve such as this one http://www.codeproject.com/KB/recipes/BezirCurves.aspx. The basic idea to create bezier curve is to use some control points and make decision how many new points need to be created. And then interpolate those new points. Here is the question: Assume I have 1000 p...

math examples for games, not for 3-D or visual/rendering, but for levels or outcomes of events etc.

Are there any tutorials on how to calculate 'outcomes' for events in a game, based on inputs like character strength, weapers, etc. Also, how do you go about making things progresively harder and challenging. I'm not looking for math for things like graphic rendering, visual objects moving around etc. This is for figuring out if e.g. ...

How to calculate inverse kinematics

I want to know how to calculate rotation angles using inverse kinematics. I am planning on using this for real time 3d animation. Anyone know of some good literature that details a specific solution? ...

Simple math/programming question. Individual percentage from total.

I'm no good at math. :) Is this right? I'm accumulating all CPU seconds, and I need to find what percentage the addon's CPU time is from the total. function PluginResources.GetTotalCPU(addon) UpdateAddOnCPUUsage() local totalCPU = 0 for i=1, GetNumAddOns() do totalCPU = totalCPU + (GetAddOnCPUUsage(i) ) end ...

How to remove colinear points from a list of points?

Hello all, Given a point list (A1, A2, A3, ...., AN), each point Ai has Ai_x, Ai_y, and Ai_z indicates the x, y, z coordinate respectively. Assume that given three point AONE, ATWO, ATHREE, a function named as checkColinear exist, i.e. checkColinear(AONE, ATWO, ATHREE) returns TRUE if points AONE, ATWO and ATHREE are colinear. I am lo...

Floating point exponentiation without power-function

Currently I have to work in an environment where the power-operator is bugged. Can anyone think of a method temporarily work around this bug and compute a^b (both floating point) without a power function or operator? ...

how can I solve non linear simultaneous equations?

i am having 12 equations and 12 unkonwns... i want to solve these equations. please help me with software or package or source code. ...

Binary numbers with the same quantity of 0s and 1s

When I was solving Euler project problem #15 I realized that it can be solved with the # of combinations of ways of the route from start to end. The route generated always has the same size of right or down choices (or 0s and 1s) and the right routes always have the same qty of 0s and 1s. So qty of numbers with the same qty of 0s and 1s ...