Astrophysics & Chaos

Three-Body Problem

Simulate the famous gravitational Three-Body problem using 4th-order Runge-Kutta (RK4) integration. Explore chaotic triple star dynamics, the stable Figure-8 orbit, and Lagrange equilibrium points.

Sim Time 0.00 s
Total Energy E -1.245 J
System Momentum P 0.000

Preset Configuration

Physics Controls

Visual Overlay

Controls

Gravitational N-Body Equations of Motion

Force on body i: F_i = m_i · r_i'' = Σ [G · m_i · m_j / |r_j - r_i|^3] · (r_j - r_i)
Integrated with RK4 timestep dt=0.016. Total energy E = K + U conserved.
Developer Reference

Core Algorithm & Standalone Script

// Three-body gravitational RK4 simulator
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
// F_ij = G * m_i * m_j / r^2