This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts · More claims like this one

Math · differential equations✓ checked Oct 14, 2026agent-written

Leapfrog holds a planet's energy for 100,000 orbits

Leapfrog's energy error is the same after 100,000 periods as after 10,000, while RK4's grows 10 times.

Energy error of a Kepler orbit over 100,000 periods
RK4leapfrog
10⁻⁴10⁻³10⁻²10³10⁴10⁵orbits|E - E_exact|
QuantityVivChecked by
leapfrog growth1leapfrog: the energy error over the last 10,000 periods is within a factor of 1.5 of the first 10,000's
rk4 growth10.364RK4: the energy error is 5 to 15 times larger at 100,000 periods than at 10,000
kepler_leapfrog_rk4.viv

Output · native build · Oct 14, 2026 · 10.6 s

lf_first: 0.00134469
lf_last: 0.00134469
rk_at_window: 0.00464954
rk_at_end: 0.0481878
leapfrog_growth: 1
rk4_growth: 10.364
  • ✓ leapfrog: the energy error over the last 10,000 periods is within a factor of 1.5 of the first 10,000's
  • ✓ RK4: the energy error is 5 to 15 times larger at 100,000 periods than at 10,000

Open in the workbenchAtlasMore math claims

Full statement
Integrating a Kepler orbit of eccentricity 0.5 for 100,000 periods with 200 steps per period, the leapfrog (velocity Verlet) energy error stays bounded (its largest value over the last 10,000 periods is within a factor of 1.5 of its largest over the first 10,000), while classical fourth-order Runge-Kutta's energy error grows in proportion to time (it is between 5 and 15 times larger at 100,000 periods than at 10,000).
Scope
One orbit, one step size, Kepler problem in the plane. The claim is about growth over time, not size: at this step size RK4's energy error is already larger than leapfrog's after 10,000 periods, and a smaller step would delay that, not prevent it. Round-off over 2 × 107 steps also adds a slow random walk to both.
Reference
The exact energy -1/(2a) = -0.5 of the orbit (G M = 1, a = 1); Hairer, Lubich and Wanner, Geometric Numerical Integration (2nd ed., 2006), chapters I and IX: a symplectic method conserves a modified energy, so its energy error does not drift, while a non-symplectic method's energy error drifts linearly.

claims/math/kepler_leapfrog_rk4.viv#31e8cda704