Gravity wells - orbit plane (2D)Switch to 3D
Experiment: measured vs predicted

Press the button: the orbit is re-integrated for one full revolution with a tiny step and the measured period is compared with Kepler's T = 2 pi sqrt(a^3/GM).

The science

A point mass in a central inverse-square field obeys r'' = -GM r / |r|^3. Two quantities are conserved: energy E = v^2/2 - GM/r and angular momentum L = r x v. The radial motion is a 1D problem in the effective potential V(r) = -GM/r + L^2/(2 r^2): the orbit lives where E >= V (the green line against the purple curve).

For E < 0 the orbit is an ellipse with semi-major axis a = -GM/(2E), eccentricity e = sqrt(1 + 2 E L^2 / (GM)^2) and period T = 2 pi sqrt(a^3 / GM) (Kepler's third law). Escape speed at radius r is sqrt(2GM/r); E = 0 is a parabola.

Units are scaled so that GM = 1 and r = 1 give a circular period of 2 pi. The integrator is velocity Verlet with an adaptive step near the well; the energy drift is shown live. This is a two-body point-mass model: no relativity, no tides, no other bodies. Same physics as the 3D page.