RE: [ODE] ODE BUG
kalikali at tlen.pl
kalikali at tlen.pl
Fri Oct 21 10:23:12 MST 2005
My formula IS correct.
Try to do simple experiment:
Put some body in the field of grafity (9,81 m/s) at height 1000 m, v0 = 0
Let's use this formula:
x = v*t + a*t^2
Assume 1 step, t = 10s, final distance is:
x = 0*10 + 9,81*10^2 = 981 m
//=================================================
Do it again with 2 smaller 5 s steps:
x = 0*5 + 9,81 * 5^2 = 245.25 m (fianal velocity after this step is: v = v0 + a * t = 0 + 9.81 * 5 = 49.05 m/s)
x = 49.05 * 5 + 9,81 * 5^2 = 490.5 m
your final distance is: 245.25 + 490.5 = 735.75 m
//==================================================
Do it once again with 4 smaller 2.5 s steps:
x = 0*2.5 + 9.81 * 2.5^2 = 61.3125 m (v = 24.525)
x = 24.525 *2.5 + 9.81 * 2.5^2 = 122.625 m (v = 49.05)
x = 49.05 *2.5 + 9.81 * 2.5^2 = 183.9375 m (v = 73.575)
x = 73.575 *2.5 + 9.81 * 2.5^2 = 245.25 m
so your final distance is: 613.125 m
//==================================================
AS YOU CAN SEE with smaller timesteps error is BIGGER !!!!
(by the way, final velocity is the same because velocity equation is correct)
The correct formula is:
x = v*t + 0.5*a*t^2
//========================================================================
What do You mean "only correct for constant acceleration" ???
Acceleration is constant in one timestep.
No matter how small the timestep is.
More information about the ODE
mailing list