Skip to content

Integrator Arena

Learning goal

See the defining pathologies of each time integrator on the cross-field benchmark: forward Euler spiraling out, backward Euler spiraling in, leapfrog locked on the cycloid, and RK4 near-exact.

Things to try

  1. Slide steps-per-period down to ~10. Watch Euler's spiral blow up while leapfrog merely lags in phase — stability vs accuracy, dissociated before your eyes.
  2. Increase the number of periods. First-order errors compound; the gap between methods widens with simulation length.
  3. Turn on RK4 at very coarse steps. Even 4th-order accuracy eventually loses the phase — high order is not a substitute for resolving the gyration.
  4. Compare backward Euler and forward Euler at the same settings — mirror-image energy errors, exactly as the averaging argument predicts.

ODE integration · Convergence & error · Leapfrog update equations