# Downsides of using this integration formula for movement?

So I read that Gaffron integration basics tutorial and noticed how the Euler integration method gives a small error over time. I implemented the RK4 and noticed that with constant acceleration, I could simplify the formula. Over the course of an hour with some use of wolframalpha, I noticed that the formula eventually just simplifies down to just this:

float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

Position += (0.5f * Acceleration * dt + Velocity) * dt;
Velocity += Acceleration * dt;


I ran it through a console and sure enough, it gives the proper values for each timestep and the correct final value.

Will this formula always yield perfectly accurate answers? My acceleration will always be constant. Is there a name for this formula?

You've discovered the equation for constant linear acceleration. This equation is used in situations of uniform acceleration to determine final position and velocity.

Essentially you start with your acceleration and integrate with respect to time to get the equation for velocity and integrate that for the equation for position.

a = a  //Acceleration
v = v0 + a*t  //Initial velocity + acceleration times time
s = s0 + (a*(t^2))/2 //Initial position + one half acceleration times time squared


If you always have constant acceleration, you can use this equation at any time to calculate the position and velocity. It should give accurate results if you're calculating from the beginning every time. You can introduce small amounts of error when adding subsequent calculations like you're doing with += in your code example.

However, many times errors are introduced when you have an acceleration that changes, like when dealing with gravity.

The downsides of using constant acceleration is that it's typically not very interesting. You're very limited to how many things you can use it for.

Typically people will use these equations in very small fixed time steps with changing acceleration to calculate the position and velocity of objects.