Orbits Demo
Gravity between a few bodies, integrated step by step. Watch the energy readout: a good integrator keeps it nearly constant, and a large time step makes it drift.
Drag to launch a body.
System
Integration
Time0
Bodies0
Total energy0
Energy drift0
What it models
Point masses attracting each other by Newton's inverse-square law with G = 1. The figure-eight solution, the 3–4–5 problem and the binary system are classic test cases for gravitational integrators.
Method
- Kick–drift–kick leapfrog: second order, time-reversible and symplectic, so energy errors oscillate instead of growing steadily.
- Every pair is computed directly (O(N²)), fine for a few dozen bodies.
- Energy drift is |E − E₀| / |E₀|; raise the time step to watch it grow.