Tech News
← Back to articles

Show HN: Browser-based interactive 3D Three-Body problem simulator

read original related products more articles

Based on Li and Liao (2025), which discovered 10,059 new 3D periodic orbits. Paper | Data

Note: Orbits may become unstable after many cycles due to numerical integration limitations.

About the N-Body Simulator

What is the Three-Body Problem? The three-body problem is one of the most famous challenges in classical physics and celestial mechanics. It asks: given the initial positions, masses, and velocities of three bodies in space, can we predict their future motion under mutual gravitational attraction? Unlike the two-body problem (which has an exact analytical solution), the three-body problem has no general closed-form solution. This makes numerical simulation the primary tool for studying these complex gravitational systems.

N-Body Gravitational Simulation This simulator uses Newton's law of universal gravitation to model the gravitational forces between every pair of bodies: F = G × m₁ × m₂ / (r² + ε²) Each body experiences the sum of all pairwise gravitational forces from every other body. For N bodies, this requires calculating N(N-1)/2 force pairs each timestep. The ε² term is a softening parameter that prevents numerical singularities when bodies pass very close together. The simulation supports multiple integration methods. By default, it uses the Velocity Verlet integration method, a symplectic integrator that provides superior energy conservation compared to simpler methods like Euler integration. This makes it ideal for long-term orbital mechanics simulations. Users can switch to the 4th-order Runge-Kutta (RK4) method in the Advanced Settings, which offers higher accuracy per timestep and typically shows lower energy drift in short simulations. However, RK4 is not symplectic and accumulates systematic phase errors over long simulation times, causing orbits to gradually decay or expand. This makes RK4 better suited for short to medium duration simulations where minimizing instantaneous error is the priority, while Verlet excels at maintaining correct orbital shapes over extended periods.

Preset Configurations The simulator includes several famous periodic three-body orbits discovered through numerical searches: 2D Orbits Figure-8 choreography: Discovered by Cris Moore in 1993, where three equal masses chase each other along a figure-eight shaped path

Discovered by Cris Moore in 1993, where three equal masses chase each other along a figure-eight shaped path Lagrange triangular configuration: Equilateral triangle configuration with circular orbits.

Equilateral triangle configuration with circular orbits. Butterfly, Broucke, Hénon, and Yarn: Periodic orbits from the Šuvakov-Dmitrašinović database of three-body choreographies, discovered through systematic numerical exploration of initial conditions 3D Orbits Three-dimensional periodic orbits from Li and Liao (2025), which discovered 10,059 new periodic solutions including 21 choreographic orbits and 273 "piano-trio" orbits (where two equal-mass bodies share one orbit while a third body follows another). Paper | GitHub

Features & Applications Real-time Physics: Experience gravitational dynamics in 3D with interactive controls

... continue reading