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?