[ODE] ODE BUG
Michael Lacher
michael.lacher at hlw.co.at
Fri Oct 21 11:20:11 MST 2005
The difference in the formula is a figment from using implicit
integeration in ODE.
[cite: taken from http://q12.org/pipermail/ode/2003-October/010154.html]
Explicit:
X(t0+h) = X(t0)+h*dX(t0)/dt
Implicit:
X(t0+h) = X(t0)+h*dX(t0+h)/dt
[/cite]
dX(t0)/dt == v0
dX(t0+h)/dt == v1 == v0 + a*h
Therefore
X(t0+h) = X(t0)+h*(v0 + a*h) = X(t0)+h*v0 + a*h*h
This is exactly what ODE implements. So the formula is indeed "correct"
in the sense that it correctly implements implicit integration, which
favors stability over accuracy.
regards,
Michael
kalikali at tlen.pl schrieb:
> I think I found some serious bug in ODE.
> Position of the body (changed by applied force) is incorrectly calculated.
>
> Position in timestep should be calculated as:
>
> x = x0 + v0 * (t - t0) + 0.5 * a * (t - t0)
>
> Currently it is calculated as:
>
> x = x0 + v0 * (t - t0) + a * (t - t0)
>
> (without * 0.5 !!!!)
>
> //==============================================================
>
> unit util.cpp (dxStepBody)
>
> b->pos[j] += h * b->lvel[j];
>
> //==============================================================
>
> Put some body in field of gravity, and do dWorldQuickStep(,10)
> Check body position
> Now, do the same, but in loop:
> for (i=0;i < 10;i++) dWorldQuickStep(,1)
> Check body position
> Positions are not the same !!!
> This is the problem
>
> //==============================================================
>
> I've made a little patch (currently only for quick step) but I
> don't know is this correct.
>
> Lukasz
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
More information about the ODE
mailing list