This simulation models gravitational motion as a true N-body problem: every massive body attracts every other through Newton's law of gravitation, with acceleration a = G·M/r². Working in astronomical units, years and solar masses sets G = 4π² from Kepler's third law. A symplectic Velocity Verlet integrator advances positions and velocities together, conserving energy over long runs so the looping orbits stay stable rather than drifting.
You choose one of three scenarios, set how many simulated years pass per real second, and toggle orbit trails, body labels, velocity vectors and the five Lagrange-point markers. Pause, reset, zoom, pan, and click a body to follow it while reading its speed and orbital radius. The same mathematics underpins real astrodynamics: planning satellite orbits, interplanetary trajectories and gravity-assist flybys that steal momentum from a planet.
What does this orbital mechanics simulation show?
It shows real gravitational motion computed as an N-body problem, where every body pulls on every other. Three scenarios are available: the inner Solar System out to Jupiter, the Sun–Jupiter Lagrange points populated with Trojan asteroids, and a gravity-assist flyby of a giant planet.
What integration method does it use?
It uses Velocity Verlet, a symplectic integrator. Symplectic schemes conserve energy and angular momentum well over long timescales, so orbits do not spiral in or fly apart through accumulated numerical error, which is exactly what makes them suited to celestial mechanics.
Which units and constants are used?
Distances are in astronomical units (AU), time in years and mass in solar masses. In these units Kepler's third law gives the gravitational constant the convenient value G = 4π² ≈ 39.48, so a planet at 1 AU orbits the Sun in 1 year.
The Scenario menu switches between the Solar System, Lagrange points and gravity assist. The Speed slider sets simulated years per real second (0.1 up to 50). Checkboxes toggle orbit trails, body labels, velocity vectors and Lagrange-point markers, and Pause and Reset freeze or restart the run.
Lagrange points are five positions in a two-body system where gravity and orbital motion balance. L4 and L5, sixty degrees ahead of and behind the planet, are stable, so small bodies cluster there. The simulation seeds 35 Trojan asteroids near Jupiter's L4 and L5, where they librate as in reality.
A spacecraft passes close to a moving planet and exchanges momentum with it. In the planet's frame the probe's speed is unchanged, but because the planet is moving in the Sun's frame, the encounter adds or removes heliocentric velocity. The flyby scenario launches a probe on a transfer orbit toward Jupiter to show this.
The physics is genuine Newtonian gravity with real relative masses and orbital radii for the Sun and planets. It is two-dimensional and uses circular starting orbits with sub-stepping for stability, so it captures the essential dynamics faithfully but is not a precision ephemeris for predicting exact positions.
In the Solar System scenario each planet starts at a random angle around its orbit for visual variety, and Trojan asteroids are scattered with small random spreads in position and speed. The underlying physics is identical; only the initial conditions differ between resets.
Clicking a labelled body locks the camera to follow it and opens a readout of its name, speed in kilometres per second and orbital radius in AU. Speed is converted using the relation that 1 AU per year is approximately 4.74 km/s, letting you compare planets quantitatively.
Mission designers use N-body integration to plan satellite constellations, station-keeping at Lagrange points such as the James Webb telescope at L2, and interplanetary routes. Voyager 2's tour of Jupiter, Saturn, Uranus and Neptune relied on chained gravity assists from a rare alignment that recurs only about every 175 years.
N-body Velocity Verlet integrator with three scenarios: inner Solar System orbits, Lagrange Points with Jupiter Trojan asteroids, and a gravity-assist flyby past a giant planet.
Velocity Verlet integration is symplectic — it conserves energy over long timescales, making it ideal for orbital simulations. Gravity-assist transfers orbital energy between bodies.
Switch between scenarios. Watch Trojan asteroids librate around Jupiter's L4/L5 Lagrange points. In flyby mode, observe how a spacecraft gains speed from planetary encounter.
Voyager 2 used four consecutive gravity assists (Jupiter, Saturn, Uranus, Neptune) — a rare planetary alignment that occurs only every 175 years. The next one is around 2152.
This is a real N-body gravity simulator: every body pulls on every other body through Newton's law of gravitation, and the motion is integrated forward in time. Astrodynamicists use exactly this kind of computation to plan satellite orbits, interplanetary missions and to track Trojan asteroids. It is fascinating because tiny initial differences and the combined tug of several masses produce the rich, looping paths you see — orbits that no single formula can describe.
a = G * M / r^2 — gravitational acceleration, where G is the gravitational constant, M the attracting mass and r the separation. Units here are AU, years and solar masses, so G = 4 * pi^2 from Kepler's third law.
Voyager 2 used four consecutive gravity assists — Jupiter, Saturn, Uranus and Neptune — thanks to a planetary alignment that happens only about every 175 years. The next such window arrives around 2152.