# Applying the distance formula d= v*t + 1/2a*t^2

• B
• whartung
Time = dt; } // calculate distance traveled // insert avg velocity into the equation double d = (vi + v_avg) * t; // calculate change in distance f

#### whartung

They have this for the distance traveled with acceleration formula:

d= v*t + 1/2a*t^2

Now, I'm quite familiar with 1/2at^2 part, it's the v*t part that's troubling me.

If I have something going 1000m/s, and a deceleration of 10, for 50s, how far does it go?

According to the first forumla, it's
Code:
d = 1000 * 50 + .5 * -10 * 50^2
= 50000 - 12500
= 37500m

Ok, that's all well and good.

However, in a simple simulation, where I have an object moving along, I create a negative acceleration vector, and I apply the vector each time blip, and I see, "experimentally" (I quote because it's software that I wrote rather than some mechanical test I measured), that the object slows down in just the 12500 space. The object speed had slowed appropriately, but the distance is only the second part of the formula.

To be fair, I've never really seen the v*t prefix to the formula before. I've always seen the 1/2at^2 part. I guess they always assumed the object was stopped, and never really talked about decelerating. Of course, it makes sense the the original velocity must be considered.

So, either my experiment is wrong, (my sim is wrong, always a possibility), or I'm just misunderstanding how it's applied. It's not that I don't doubt my sim (bad information properly applied is still wrong), but the numbers work out using other formulas when cross checking. So, befuddlement ensues.

(Is there a better way to do math here, or do we just wing it?)

They have this for the distance traveled with acceleration formula:

d= v*t + 1/2a*t^2

Now, I'm quite familiar with 1/2at^2 part, it's the v*t part that's troubling me.
That formula is written wrong, it should use ##v_0## the veolocity at time t = 0, not ##v## which we often means the velocity at the time t. Also, the formula is only valid for constant acceleration.

To be fair, I've never really seen the v*t prefix to the formula before. I've always seen the 1/2at^2 part. I guess they always assumed the object was stopped, and never really talked about decelerating. Of course, it makes sense the the original velocity must be considered.
If something is starting at rest, then the "v*t" is zero, well it should read ##v_0t## as I mentioned above.

You are thinking a bit too complicated here I think. What if the acceleration is zero, and an object is moving at constant velocity ##v_0##? What would the distance traveled be then? Well you guessed it, it is of course ##d = v_0t##, a "special case" of the formula ##d = v_0t + at^2/2##.

Let's now consider how the distance traveled changes if you also have an acceleration. Let's take an acceleration that makes the object go faster and faster. It is clear that we would get a larger d now than with the case when a = 0.
This v-t diagram shows what is happening. ok great, we know d will be bigger now than if a = 0. But can we calculate d for a non-zero a?
Consider the average velocity ##v_\text{avg} = (v_0+v)/2##. If the object moved with this velocity ##v_\text{avg}## as a constant velocity, it would travel the same distance is if was accelerating from ##v_0## to ##v## with the acceleration a. We thus have that ##d =v_\text{avg}\cdot t = (v_0+v)t/2##. But we also have that ##v=v_0 + at##, insert this into our formula for ##d## and we get the final formula ##d = (v_0+v_0 + at)t/2 = v_0t + at^2 / 2##

However, in a simple simulation, where I have an object moving along, I create a negative acceleration vector, and I apply the vector each time blip, and I see, "experimentally"
If you could be so kind to post your code, we would be happy to point out where there is a wrong.

Last edited:
• PeroK
Well it seems it's been working all along, it was a matter of the values I was working with.

Java:
package pkg;

public class Accel {

public static void main(String[] args) {
accel(1000, -10, 50, 5);
accel(10000, -10, 1000, 100);
}

public static void accel(double vi, double a, double t, double dt) {

double x = 0;
System.out.println("a=" + a + " - t=" + t + " - final v=" + a * t + " d should be = " + (vi * t + (.5 * a * t * t)) + " d = " + (.5 * a * t * t));
double totalTime = 0;
double acc = a * dt;
while (totalTime <= t + 1) {
System.out.println(totalTime + " x = " + x + " v " + vi);
double ovi = vi;
vi = vi + acc;
x = x + ((ovi + vi) / 2) * dt;
totalTime = totalTime + dt;
}
}
}

The first run, the first line, is the scenario in the post. And you see that works out, X = 37500. So, huzzah.

For the second example, I guess the numbers just worked out that $\frac 12 at^2$ happens to match the $vi*t + \frac 12 at^2$.

Code:
a=-10.0 - t=50.0 - final v=-500.0 d should be = 37500.0 d = -12500.0
0.0 x = 0.0 v 1000.0
5.0 x = 4875.0 v 950.0
10.0 x = 9500.0 v 900.0
15.0 x = 13875.0 v 850.0
20.0 x = 18000.0 v 800.0
25.0 x = 21875.0 v 750.0
30.0 x = 25500.0 v 700.0
35.0 x = 28875.0 v 650.0
40.0 x = 32000.0 v 600.0
45.0 x = 34875.0 v 550.0
50.0 x = 37500.0 v 500.0

a=-10.0 - t=1000.0 - final v=-10000.0 d should be = 5000000.0 d = -5000000.0
0.0 x = 0.0 v 10000.0
100.0 x = 950000.0 v 9000.0
200.0 x = 1800000.0 v 8000.0
300.0 x = 2550000.0 v 7000.0
400.0 x = 3200000.0 v 6000.0
500.0 x = 3750000.0 v 5000.0
600.0 x = 4200000.0 v 4000.0
700.0 x = 4550000.0 v 3000.0
800.0 x = 4800000.0 v 2000.0
900.0 x = 4950000.0 v 1000.0
1000.0 x = 5000000.0 v 0.0

Thank you for your help. It didn't make any sense to me, but didn't occur to me that I was hitting an edge case right off the bat.

Perhaps you get less confused if you instead of calling "acc = a*dt" you call it "Delta_v" or similar.

This part I do not understand
Code:
"a=" + a + " - t=" + t
acceleration should be constant for the formula to apply.

Perhaps you get less confused if you instead of calling "acc = a*dt" you call it "Delta_v" or similar.
Yea, I mean, I consider it an "acceleration" vector, which it isn't, but that's how I have it in my Pooh brain.
This part I do not understand
I'm simply displaying the parameters to the function, and the two different d calculations to compare with the run results.

Thanks again for the insight.

I'm simply displaying the parameters to the function, and the two different d calculations to compare with the run results.
Ah right, I thought the "-" meant minus

If you know calculus, there is even cooler way to get to that forumla

Consider a constant acceleration ##a ##, but ##a = \dfrac{\mathrm{d}v}{\mathrm{d}t}## so ##v = at + \text{constant}##. What should this constant be? Well if ##t=0## then we should get ##v=v_0##, the velocity at time ##t=0##. So we have ##v=v_0 + at##.

But the velocity is the rate of change in the position over time, this means that we have ##v = \dfrac{\mathrm{d}x}{\mathrm{d}t}##. This means that ##v_0 + at = \dfrac{\mathrm{d}x}{\mathrm{d}t}## so we get ##x = v_0 t + \dfrac{at^2}{2} + \text{constant}##. What should this constant be? Well, similar as before, ##t=0## should give us ##x = x_0## the position at ##t=0##. We finally obtain ##x = x_0 + v_0t +\dfrac{at^2}{2} ##. Using the displacement ##x - x_0## we can write this formula as ##d = v_0t +\dfrac{at^2}{2} ##