N-Body Gravity

Verlet integration — click to add bodies, watch orbits form

G: 1.0
dt: 0.10
Mass: 10
Trail: 150
Energy:    Bodies: 0   Time: 0
N-Body Problem: Each body exerts gravitational force F = G·m₁m₂/r² on every other body. The equations of motion are integrated using Velocity Verlet: x(t+dt) = x(t) + v·dt + ½a·dt², v(t+dt) = v(t) + ½(a+a')·dt. This is a symplectic integrator that approximately conserves energy. A softening parameter ε prevents singularities when bodies pass close. Energy conservation E = ΣKE + ΣPE should remain constant — drift indicates numerical error. The three-body problem has no general closed-form solution (Poincaré 1890), making N-body simulation essential for celestial mechanics.