ODE Integrator Race — Euler vs RK2 vs RK4
Watch Euler, midpoint (RK2) and classical Runge-Kutta (RK4) integrate the same gravitational orbit side by side. Tune the step size and eccentricity and see truncation error pull each method off the true ellipse in real time, with live energy-drift readouts.
Three numerical integrators — first-order Euler, second-order midpoint (RK2), and classical fourth-order Runge-Kutta — chase the same inverse-square gravitational orbit from an identical starting point, using the identical step size h. Because they discretize the same differential equation with different local truncation error (O(h), O(h²) and O(h⁴) respectively), their trajectories peel away from the true Kepler ellipse at very different rates: Euler visibly spirals outward within a few orbits, RK2 tracks the ellipse much longer before drifting, and RK4 stays locked to it well past both. Live energy-drift readouts turn "which method is more accurate" from an abstract claim into a number you can watch grow in real time as you push the step size or eccentricity higher.
Watch Euler, RK2, and RK4 solve gravitational orbits; their paths diverge as step size and eccentricity increase.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install