1. ## Predicting Tartget Speed

Hey
- I have a Ball moving at a Speed S.
- The Ball has an InitialSpeed iS
- The Ball has a TargetSpeed tS

Every second:
- Ball is displaced S number of pixels
- S is multiplied by deacceleration D ( D is a number between 0 - 1 )

...
I need an expression, returning how many pixels the Ball moves before reaching TargetSpeed tS ( tS is allways lower or equal to iS )
( Time is integer only )

Hope this makes sense.

2. ## Re: Predicting Tartget Speed

Forgive me but I'm going to change your notation a bit, so that it's less confusing.

Let:
v = velocity,
V_i = initial velocity
V_t = target velocity
T = time to reach target velocity
X = distance traveled to reach target velocity

The equation of motion that you are describing is this:

$v = V_i(D^t)$

From this we have $\frac {V_t}{V_i}= D^T = e^{T \ln( D)}$. Hence the time to reach the target velocity is $T = \frac {\ln(V_T/V_i)}{\ln D}$

The distance traveled in time T is:

$X = \int_{t=0} ^{t=T} v dt = \int_{t=0} ^{t=T} V_i e^{(ln (D))t} dt = \frac {V_i}{ln(D)}(D^T-1)$

Substituting the value for T we get:

$X = \frac {V_i}{ln(D)}(D^{\frac {\ln(V_T/V_i)}{\ln D}} - 1)$

Hope this helps!

3. ## Re: Predicting Tartget Speed

Thanks Ebaines

...
I made a simple computer program:

V_i = 4
V_t = 3
D = 0.99

This expression is copied directly from the program ( after implementing it ):
( ( 0.0 + value( "VelocityInitial" ) ) / Ln( 0.99 ) ) * ( 0.99 * ( Ln( ( 0.0 + value( "VelocityTarget" ) ) / value( "VelocityInitial" ) ) / Ln( 0.99 ) ) - 1 )

Ill simplefy it so it is easier to read:
( ( 0.0 + V_i ) / Ln( D ) ) * ( D * ( Ln( ( 0.0 + V_t ) / V_i ) / Ln( D ) ) - 1 )

...
By doing a Step by Step test in the programm, i find:
- It takes 29 turns/ steps/ seconds for V_i to reach V_t
- As V_i reaches V_t, the Ball has traveled very close to 100 pixels

However, the expression provided ( see below )
( ( 0.0 + V_i ) / Ln( D ) ) * ( D * ( Ln( ( 0.0 + V_t ) / V_i ) / Ln( D ) ) - 1 )

outputs: -10880.4

...
Am i doing someting wrong in the expression, does this expression not fit my situation, or does the problem lie somewhere else ( in the program maybe )?

4. ## Re: Predicting Tartget Speed

Originally Posted by CakeSpear
Ill simplefy it so it is easier to read:
( ( 0.0 + V_i ) / Ln( D ) ) * ( D * ( Ln( ( 0.0 + V_t ) / V_i ) / Ln( D ) ) - 1 )
You misread the forumula - it should be:
( ( 0.0 + V_i ) / Ln( D ) ) * ( D ^ ( Ln( ( 0.0 + V_t ) / V_i ) / Ln( D ) ) - 1 )

Note thatin this formula the number D is raised to the power of (ln(V_t/V_i))/lnD, not multiplied by it.

Originally Posted by CakeSpear
By doing a Step by Step test in the programm, i find:
- It takes 29 turns/ steps/ seconds for V_i to reach V_t
- As V_i reaches V_t, the Ball has traveled very close to 100 pixels

However, the expression provided ( see below )
( ( 0.0 + V_i ) / Ln( D ) ) * ( D * ( Ln( ( 0.0 + V_t ) / V_i ) / Ln( D ) ) - 1 )

outputs: -10880.4
Make the correction and you'll find the formula gives an answer of 99.5 pixels, and T=28.6 steps.

5. ## Re: Predicting Tartget Speed

Aha, didnt see that.

Excellent it works!
Thanks again Ebaines!