LeapFrog method ODE solver.
The LeapFrog algorithm is a third order algorithm that uses the acceleration to estimate the
final position. Note that the velocity plays no part in the integration of the equations.
x(n+1) = 2*x(n) - x(n-1) + a(n)*dt*dt
v(n+1) = (x(n+1) - x(n-1))/(2 dt) + a(n)*dt
The LeapFrog algorithm is equivalent to the velocity Verlet algorithm except that it is not self starting.
It is faster than the the velocity Verlet algorithm because it only evaluates the rate once per step.
CAUTION! You MUST call the initialize if the state array is changed.
The LeapFrog algorithm is not self-starting. The current state and a prior state
must both be known to advance the solution. Since the prior state is not known
for the initial conditions, a prior state is estimated when the
initialize method is invoked.
CAUTION! This implementation assumes that the state vector has 2*N + 1 variables.
These variables alternate between position and velocity with the last variable being time.
That is, the state vector is ordered as follows:
x1, d x1/dt, x2, d x2/dt, x3, d x3/dt ..... xN, d xN/dt, t
Steps (advances) the differential equations by the stepSize.
The ODESolver invokes the ODE's getRate method to obtain the initial state of the system.
The ODESolver then advances the solution and copies the new state into the
state array at the end of the solution step.