🪐 N-Body Gravitational Simulation
Every pair of bodies attracts each other with force F = G·m₁·m₂/r² (Newton's law of universal gravitation). The equations of motion are integrated with RK4. The general three-body problem has no closed-form solution and exhibits sensitive dependence on initial conditions (chaos). However, special stable configurations exist — such as the figure-8 orbit and Lagrange-point equilibria. Click the canvas to add a new body; use preset configurations to explore classic N-body scenarios. 🇺🇦 Українська
Presets
Numerical methods and chaos
RK4 integrates the coupled ODEs: ẍᵢ = Σⱼ G·mⱼ·(xⱼ−xᵢ)/(|rᵢⱼ|²+ε²)^(3/2). A softening parameter ε prevents singularities at close encounters. Total energy (KE + PE) and angular momentum are approximate conserved quantities — monitor them to judge integration quality. The figure-8 three-body orbit (Chenciner & Montgomery, 2000) is exact only with a specific mass ratio and velocities; small perturbations eventually cause it to break apart — you can see chaos in action.