Forward Euler Symplectic Euler Velocity Verlet

Gravitational Integrators: Symplectic vs Euler Energy Drift (2D)

This 2D companion to the 3D N-body sandbox isn't about rendering more bodies — it puts three real numerical integrators side by side on the identical gravitational system (same masses, same starting positions and velocities, same pairwise 1/r² force law) and lets you watch, in real time, which ones conserve energy and which ones don't. Forward Euler visibly spirals outward and gains energy; symplectic (semi-implicit) Euler — the method the 3D version itself uses — keeps energy oscillating in a bounded band; velocity Verlet (leapfrog) holds the tightest band of all. A Δt slider lets you push all three into instability and read the exact percentage drift live, turning an abstract numerical-methods concept into something you can literally watch happen.