physics that keeps jupiters asteriods in place
five points in space where gravity balances some hold forever , some don't.

What it does
Libration — Real-Time Simulation of the Circular Restricted Three-Body Problem What it is A real-time physics simulation of the five Lagrange points — the equilibrium locations created when two massive bodies orbit a common center of mass. These aren't fictional; they're the same points that hold Jupiter's ~10,000 known Trojan asteroids in place and the same point (Sun–Earth L2) where JWST currently sits, station-keeping with almost no fuel. How it works The simulation integrates the actual Circular Restricted Three-Body Problem equations of motion — no shortcuts, no pre-baked animation: Code x'' - 2y' = ∂Ω/∂x y'' + 2x' = ∂Ω/∂y where Ω is the Jacobi effective potential combining gravity from both bodies with the centrifugal effect of the rotating frame. Every one of ~1,800 particles is stepped forward with 4th-order Runge-Kutta integration, frame by frame. The five Lagrange points themselves are found by numerically solving for the roots of this potential, not hardcoded coordinates. The glowing "terrain" you see rendered underneath is that same potential, sampled on a grid — it's data, not a background image. Why it's cool You can watch stability and instability happen, not just be told about them. Particles seeded at L4/L5 librate in stable tadpole orbits indefinitely — a direct, visual proof of Routh's stability criterion (μ < 0.0385). Particles seeded at L1, L2, and L3 slowly drift away over the course of the simulation, because those points are genuine saddle points of the potential — the instability is computed, not scripted. One click changes your entire frame of reference. Toggling rotating ↔ inertial frame is just a rotation matrix applied to the same underlying physics — in one view the Lagrange points sit frozen while particles swarm around them; in the other, everything visibly orbits together. It's the clearest possible demonstration that "stationary" and "orbiting" are just two descriptions of the same motion. It's the real mechanism behind real spacecraft and real asteroid populations — this isn't an abstract toy system, it's the exact math NASA uses to plan Lagrange-point missions. Built entirely in vanilla JavaScript and Canvas2D — no physics engine, no shader tricks, just the equations themselves running at 60fps.