Chris Collins

Tools · physics

Orbital mechanics

An n-body gravity simulator with presets (Sun–Earth–Moon, inner planets, the figure-eight three-body orbit, a binary star, a Jupiter Trojan), plus Hohmann transfer, Kepler's-law, escape-velocity, and orbital-element calculators.

Added

How to use it
  • N-body simulator: pick a preset and watch it run. Drag to pan, scroll to zoom, double-click to fit; Centre on follows one body, and Co-rotating frame rotates the view with the first two bodies (so the Trojan at Jupiter’s L4 point stays put and its libration shows). The readout shows total energy, its relative drift ΔE/|E₀|, and the angular-momentum drift — a direct measure of integrator error.

  • Integrators: velocity Verlet (kick–drift–kick) is symplectic, so its energy error oscillates but stays bounded over millions of steps. RK4 is fourth-order accurate but not symplectic; over long runs its energy drifts. Raise the time step to see both fail differently.

  • Hohmann transfer: Δv for the two burns, time of flight, and the transfer ellipse between two circular coplanar orbits, around Earth or the Sun. Enter radii or altitudes; heliocentric transfers also show the synodic period (time between launch windows) and the lead angle the target needs at departure. Plane changes, gravity losses, and the escape/capture hyperbolas at each planet are not included, so interplanetary values are heliocentric Δv only.

  • Orbit calculator: circular and escape velocity at an altitude, Kepler’s third law (period ↔ semi-major axis, e.g. GEO from a sidereal day), and periapsis/apoapsis speeds for an ellipse from vis-viva.

  • Elements ↔ state: convert classical elements (a, e, i, Ω, ω, ν) to position and velocity vectors and back.

Units: presets use astronomical units with days or years (G scaled so the Sun’s mass is 1); the figure-eight uses G = m = 1. Gravitational parameters μ = GM are the standard IAU/JPL values. The simulator is two-dimensional and Newtonian — no relativity, tides, or non-spherical bodies.

⛶ Full screen (or F) gives the N-body simulator the whole screen — the browser’s full screen where it is allowed, otherwise a full-window layer (iPhone); ◫ Panels hides the settings column. Escape leaves.

Sharing

Share link (under the title) copies a URL that reopens this tool exactly as you have it — every tab’s inputs, with the current tab selected. Opening such a link replaces the inputs this browser had saved for the tool.

You can also write a link by hand with the readable parameters preset — for example ?preset=Sun–Earth–Moon.

Runs entirely in your browser; nothing you type leaves this page.