Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a programming problem, but it's specifically math-based and the programmers I know aren't able to point me to the right solution.

Math has always been my worst subject. I'm usually pretty good with the logical aspect of it, but getting specific numbers to do what I need can get impossible.

I've got a value, X, and values T ('to') and F('from'). There are also a multitude of unknown values ({Stars}) which have to scale with X.

Each time step (which varies), I need to multiply X and {Stars} by the same amount. After (S) seconds, X should be equal to T.

By definition, X is F, and at the end of the operation, X is equal to (X * T/F) (which is equal to T). For the sake of simplicity, it's impossible for X to ever equal or pass zero (so T and F are always the same sign).

Each time step, I need to do something like this, but I don't know how to calculate the ? value:

while ( time < S )
  mux = 1 + ? * timestep
  X = X * mux
  {Stars} = {Stars} * mux
// after the loop, X is guaranteed to be (initial X0 * F/T) (which is T)
// {Stars} contains unknown values which have scaled with X to become F/T * their original value
share|cite|improve this question
Alright, it appears that I've solved it. There's still a hiccup at the endpoint, but I think that's due to some programming error I haven't tracked down yet. The actual change in X appears to be correct. First, the basic operation to get X from F to T - a simple slope equation (executed iteratively) >X = X + timestep * slope, where slope = (T-F)/total time But I need to use multiplication (since I need to multiply each value by the same amount to get them to scale together) >X + timestep * slope = X * Z, where Z is the ? in my question >1 + timestep * slope / currentX = Z – Loius Dec 7 '12 at 23:07
So the while loop becomes: while ( time < S ) mux = 1 + timestep * slope / X X = X * mux {Stars} = {Stars} * mux – Loius Dec 7 '12 at 23:07
WELP that's unreadable xD As soon as I can answer the question I'll move those to an answer. – Loius Dec 7 '12 at 23:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.