Skip to contents

Fixed step symplectic methods of OrdinaryDiffEqSymplecticRK for DynamicalODEProblem() and SecondOrderODEProblem() (pass dt). The state is c(v, u) with dv/dt = f1(v, u, p, t) and du/dt = f2(v, u, p, t); separable Hamiltonian systems have f1 = -dV/du and f2 = dT/dv.

Usage

SymplecticEuler()

VelocityVerlet()

VerletLeapfrog()

LeapfrogDriftKickDrift()

PseudoVerletLeapfrog()

McAte2()

Ruth3()

McAte3()

CandyRoz4()

McAte4()

CalvoSanz4()

McAte42()

McAte5()

Yoshida6()

KahanLi6()

McAte8()

KahanLi8()

SofSpa10()

Value

An algorithm object.

Details

  • SymplecticEuler(): first order, semi implicit Euler.

  • VelocityVerlet(): second order; needs f2(v, u, p, t) = v (a second order problem) and stops otherwise.

  • VerletLeapfrog(): second order kick drift kick leapfrog, one f1 evaluation per step; LeapfrogDriftKickDrift() is its drift kick drift form for f1 depending on v (two evaluations). Both default to linear interpolation of the saved steps (dense = FALSE).

  • PseudoVerletLeapfrog() and McAte2() (second order), Ruth3() and McAte3() (third), CandyRoz4(), McAte4(), CalvoSanz4() and McAte42() (fourth; McLachlan's method upstream marks as broken), McAte5() (fifth), Yoshida6() and KahanLi6() (sixth), McAte8() and KahanLi8() (eighth) and SofSpa10() (tenth order) are compositions of drifts and kicks with the coefficients of Julia.

Dense output is cubic Hermite interpolation from the derivatives the steps keep at both ends. sol$stats$nf counts evaluations of f1 and sol$stats$nf2 those of f2, as Julia does. After an event that changes the state, every method steps on from the derivatives of the new state (upstream VelocityVerlet(), VerletLeapfrog() and the compositions reuse those from before the event).

Examples

prob <- SecondOrderODEProblem(function(v, u, p, t) -u, 0, 1, c(0, 1))
sol <- solve(prob, McAte5(), dt = 0.1)
sol$u[[length(sol$t)]] - c(-sin(1), cos(1))
#> [1] 1.532496e-11 1.575760e-09
solve(prob, VelocityVerlet(), dt = 0.1)$stats$nf
#> [1] 11