loading...
running...
How to use
Pick a scenario or build your own: change the star mass, make Jupiter 300 times heavier, or add a custom planet with any semi-major axis, eccentricity and mass. Click a body to select it: the graphs then show its distance, speed against the vis-viva prediction and areal speed. Equal-area wedges show Kepler's second law. Space pauses, R resets.
Drag to orbit, wheel to zoom, click a planet to select it.
The science
Newtonian N-body. Every body i feels the gravity of all others:
a_i = G Σ_{j≠i} m_j (r_j - r_i) / (|r_j - r_i|² + ε²)^(3/2), G = 4π² AU³ / (Msun yr²)
In those units a planet on a 1 AU circular orbit has a period of exactly 1 year. A tiny softening ε = 1e-4 AU prevents division by zero in extremely close passes. The simulation is planar (all orbits in one plane) and starts every planet at perihelion with typical J2000 mean elements; the orientation of each orbit is approximate and the real planets' small inclinations are ignored.
Integrator. Velocity Verlet (kick-drift-kick) is symplectic: it conserves angular momentum to rounding and keeps the energy error bounded and oscillating, which is why long orbit simulations use it. RK4 is more accurate per step but its energy error drifts secularly; explicit Euler gains energy and spirals planets outward (try the Euler drift preset).
Kepler's laws follow from the model rather than being imposed. I (ellipses): osculating elements a and e come from the state vector with the vis-viva relation v² = GM (2/r - 1/a). II (equal areas): dA/dt = h/2 with h = |r × v| constant for a central force; the 2D page draws wedges that sweep equal areas in equal intervals. III: T² = a³ / M (a in AU, T in yr, M in solar masses), shown as the log-log graph where all planets lie on one line. With several massive bodies these are osculating, not exact: Jupiter and Saturn perturb each other and the star wobbles around the barycentre (a few solar radii for the real Jupiter).
Scenarios. The Halley-like comet (a = 17.8 AU, e = 0.967) is a massless test body: it moves very fast near perihelion yet sweeps the same area per unit time. The binary scenario puts a planet around a 1.0 + 0.6 Msun pair; it is stable near 2 AU and chaotic closer in. The figure-eight is the Chenciner-Montgomery three-body choreography in scaled units (G = m = 1), an exact periodic solution with period 6.32591398.
Checks. Kepler III is measured from a simulated 5.2 AU orbit; Kepler II compares the swept area with the analytic h dt / 2; energy and angular momentum are tracked for 100 simulated years of the eight-planet system; the figure-eight must return to its start after one period. Honest limits: no general relativity (Mercury's perihelion precession is not reproduced), no planetary moons, no non-gravitational forces, planar motion.
3D display notes. Planet and Sun sizes are exaggerated (slider) and distances can be compressed with r^p so that Mercury and Neptune both fit; the physics always uses true distances. The asteroid belt, the Moon and planet spin are decorative (circular Kepler motion / constant spin), not part of the N-body integration. Textures and models were made in Blender.