Visualizations
432 / 500

432 · Astronomy

Kirkwood Gaps

Thousands of asteroids and Jupiter's resonances carving gaps into a featureless belt.

About 3,800 asteroids orbit the Sun while Jupiter moves on its real eccentric orbit. They are advanced with the Wisdom-Holman symplectic map: an exact Kepler drift for each asteroid (solved with f and g functions and Newton's method on the eccentric anomaly) alternates with a kick from Jupiter, and consecutive half-drifts are fused, which lets it run thousands of years per second. Where an asteroid's period is a simple fraction of Jupiter's, the kicks add up: at 3:1 and 5:2 the orbits turn chaotic, eccentricities climb until perihelion crosses Mars's orbit, and the asteroid is removed, while the 3:2 resonance shelters the Hildas and the 1:1 holds the Trojans at L4 and L5. The real gaps took millions of years, so Jupiter's mass is boosted (shown on screen) to shorten the timescales. The disc is a long exposure in the frame turning with Jupiter, next to a scatter of semi-major axis against eccentricity and a histogram of semi-major axes averaged over ten Jupiter years, the way proper elements strip the fast wobble.

Try it. Click the scatter or the histogram to seed 150 asteroids at that distance, or click the disc to drop a cloud there. Plus and minus change Jupiter's mass, F switches between the turning and the fixed frame, up and down change the speed, R starts a fresh belt and Space pauses. Left alone, it lets the belt evolve and later drops swarms into the Hilda and Trojan zones.

  • Wisdom-Holman symplectic map
  • Kepler f and g functions
  • Mean-motion resonances
  • Long-exposure accumulation
  • Running-average proper elements

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a simulation of the asteroid belt that shows how Jupiter carves the Kirkwood gaps, with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens (scale by devicePixelRatio), and resizes with the window. Paint it a deep navy.
- Use units of AU and years, so the Sun's GM is 4 * pi^2. Put Jupiter on its real orbit (semi-major axis 5.2 AU, eccentricity 0.048), placed each step by solving Kepler's equation with a few Newton iterations; its eccentricity is what makes the resonances chaotic. Make its mass about 5 times the real one (0.005 of the Sun's) so the effects show up in seconds instead of millions of years.
- Create about 2,000 asteroids with semi-major axes spread evenly from 2.0 to 3.5 AU and small random eccentricities. Treat them as massless: each feels the Sun and Jupiter, and Jupiter feels nothing.
- Integrate with a leapfrog at a step of about a fortieth of Jupiter's year, and run many steps per frame. Remove any asteroid whose perihelion drops inside Mars's orbit (1.67 AU).
- Draw the asteroids top-down as tiny dots, and below them a histogram of their semi-major axes, computed from position and velocity with the vis-viva equation.

Once that works, make it beautiful:
- Average each asteroid's semi-major axis over several Jupiter years before histogramming it, so the gaps show as clean notches, and mark the 3:1, 5:2 and 2:1 resonances.
- Color each asteroid by its eccentricity, and plot semi-major axis against eccentricity so the resonances rise as spikes.
- Draw the disc in the frame turning with Jupiter and let positions accumulate in a slowly fading layer, like a long exposure.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a Wisdom-Holman integrator with exact Kepler drifts, adding the Hildas and Trojans further out, or simulating Mars itself instead of a removal rule.
PreviousInfinity MirrorA mirrored room of neon and glowing orbs, reflected into an endless kaleidoscope. NextHurricaneA satellite loop of a hurricane, driven by a vortex you can steer over a warm ocean.

Related visualizations

  • Starry MessengerAstronomy Jupiter's moons seen through a small telescope and sketched night by night in 1610.
  • Orbital ResonanceAstronomy A seven-planet resonant chain that chimes on every transit and weaves its own spirograph.
  • Ground TracksAstronomy The snakes, loops and figure eights real orbits trace over a turning world.
  • Retrograde LoopsAstronomy Why Mars backs up against the stars, drawn by Copernicus and Ptolemy side by side.
  • Grand TourGames Plan a probe's slingshot route past Jupiter, Saturn, Uranus and Neptune.
  • RingmakerAstronomy Backlit planetary rings with shepherd moons, wavy gap edges, propellers and waves.
  • AnalemmaAstronomy A garden noon mark traces the figure eight of Earth's orbit, one stud a day.
  • Planet ForgeAstronomy A dusty disk grows rocky worlds, ice giants and gas giants by N-body accretion.
  • CometAstronomy A comet rounds the Sun and grows a straight blue ion tail and a curved dust tail.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs