loading...
Semi-major axis of each planet relative to its start value, a(t) / a(0): resonant exchange of energy shows as anti-correlated wobbles
Period ratio P2 / P1 of the inner pair (solid) with the neighbouring first-order resonances (dashed)
Conservation test: relative energy error (orange) and angular-momentum error (blue), log scale
Resonance angle of the inner pair, (j+1) lambda2 - j lambda1 - varpi1: libration (a bounded wiggle) means the pair is locked in resonance
running...
The science
The model. A star of mass M and up to four planets interact through Newtonian gravity. Every body attracts every other, so each planet feels the star and its siblings:
a_i = sum_{j != i} G m_j (r_j - r_i) / |r_j - r_i|^3, G = 4 pi^2 AU^3 / (M_sun yr^2)
With one planet this is the exactly solvable Kepler problem; with two or more planets it is a genuine N-body problem with no general closed form, which is why orbits can lock into resonances, exchange angular momentum or scatter.
Integrator. The page uses the kick-drift-kick leapfrog: half a velocity kick, a full position drift, half a kick again. It is second-order, symplectic and time-reversible: the energy error does not grow with time but oscillates (a "shadow Hamiltonian" is conserved), the angular momentum is conserved to rounding error, and running the same steps backwards after flipping the velocities returns exactly to the start. The time step is a fraction (1/300) of the shortest orbital period, shortened for eccentric orbits by (1-e)^1.5, so periapsis is resolved. All three properties are checked in the page.
Osculating elements. From the instantaneous position and velocity relative to the star the page derives the orbit that would be followed if the other planets vanished: a = (2/r - v^2/mu)^-1, e = (v x h)/mu - r/|r|, mu = G (M + m) These elements wobble in a multi-planet system; the graphs show those wobbles. The mean longitude is lambda = M + varpi where M = E - e sin E is the mean anomaly and varpi the longitude of periapsis.
Mean-motion resonance. If the period ratio of two planets is close to (j+1):j then conjunctions repeat at the same orbital longitude and the small tugs add up coherently. The resonance angle phi = (j+1) lambda_2 - j lambda_1 - varpi_1 librates (oscillates about a fixed value) when the pair is truly locked, instead of circulating through 0 to 360 degrees. Locked pairs exchange energy and angular momentum periodically, which appears as anti-correlated oscillations of the two semi-major axes. Many real systems sit in or near resonances (Jupiter's moons Io-Europa-Ganymede in 4:2:1, Neptune and Pluto in 3:2, several exoplanet chains).
Hill stability. The Hill radius of a planet, R_H = a (m / 3M)^(1/3), is the zone where the planet's gravity dominates. For two planets of masses m1, m2 the mutual Hill radius is R_H,mutual = ((m1 + m2) / (3 M))^(1/3) (a1 + a2) / 2 and for initially circular orbits Gladman (1993) showed that a separation Delta > 2 sqrt(3) R_H,mutual (about 3.46) guarantees the planets can never have a close encounter. Closer pairs may be unstable, which is the "Too close" preset. The page runs a short numerical experiment to confirm that a gap of 2 R_H leads to close encounters while 4.5 R_H does not.
Habitable zone. The green band is the range of orbit sizes where liquid water could exist for an Earth-like planet, scaled from the stellar luminosity (L = M^3.5 for solar-type stars, a shallower law for red dwarfs) as 0.95 sqrt(L) to 1.67 sqrt(L) AU. It is a rough guide only.
Honest simplifications. (1) Point masses: no tides, no general relativity, no planetary oblateness; the star does not lose mass or evolve. (2) The initial elements are heliocentric and treated as osculating at t = 0; "stable" refers to the simulated time only, chaotic systems can be unstable on much longer times than shown. (3) The mass-luminosity relation and the habitable-zone coefficients are approximate. (4) The 2D picture is a projection onto the reference plane; inclinations matter for the 3D page. (5) Close encounters use a tiny softening length (1e-7 AU) to avoid a singular force.
Checks run in the page. (a) Kepler's third law including the planet mass; (b) energy drift of a two-planet system over 300 years; (c) conservation of angular momentum; (d) the centre of mass stays at rest; (e) time reversibility; (f) a test planet on an e = 0.5 orbit against the analytic solution of Kepler's equation; (g) the Hill-stability experiment (2 and 4.5 mutual Hill radii).