3-Body Problem Simulator

chaotic gravity, twin-run divergence, and numerical stability

Loading interactive simulation...

why does it look the same on every refresh?

The three-body problem is chaotic but not random. Chaos means tiny differences in initial conditions grow exponentially β€” but refreshing the page changes nothing: same initial positions, same velocities, same dt, same algorithm, same result every time. Deterministic chaos and computational reproducibility are two different things. To actually see the chaos: set perturbation to 0.000001 and watch the dashed twin trajectory. Both trajectories start 10⁻⁢ apart and eventually diverge into completely different paths. That exponential separation is the chaos β€” the Lyapunov exponent at work. The divergence chart below the orbits plots log₁₀ of that separation over time; a straight rising line means exponential growth.

why three is the hard number

Two bodies pulling on each other trace simple, endlessly repeating ellipses β€” that case Newton solved with pen and paper. Add a third body and the neat formula disappears: there is no general equation for where everyone ends up, so the only way forward is to advance the simulation one tiny dt at a time, exactly as this tool does. Click the figure-8 preset to meet one of the rare exceptions β€” three equal masses forever chasing each other along a single looping path.

the solution that exists but is useless

People often call the three-body problem 'unsolvable', yet in 1912 Karl Sundman proved a convergent power series in t1/3 that yields the bodies' positions for all time (barring triple-collision starts). The catch: it converges so slowly that astronomical accuracy would demand on the order of 108000000 terms β€” hopelessly beyond any computer. A formal solution truly exists; stepping the simulation forward, as here, is simply the only usable route.

Problem solved in full

  1. Energy of the figure-8 choreography for 3 equal masses from initial conditions 7 steps

    The figure-8 choreography sends 3 equal masses around a single closed curve. Work out its energy at t = 0 from the initial conditions alone. This is the figure-8 orbit preset: G = 1, m1 = m2 = m3 = 1, softening Ξ΅ = 0. Positions r1 = (βˆ’0.97000436, 0.24308753), r2 = βˆ’r1, r3 = (0, 0); velocities v1 = v2 = (0.466203685, 0.43236573), and the total momentum is 0.

    Open this problem in the tool

    1. Those long decimals look arbitrary. Square them and add, and they are not: bodies 1 and 2 each sit exactly 1 unit from the origin, which is where body 3 is.

      ∣r1∣=0.970004362+0.243087532=0.940908+0.059092=1.0000|\mathbf{r}_1|=\sqrt{0.97000436^{2}+0.24308753^{2}}=\sqrt{0.940908+0.059092}=1.0000
    2. Body 2 is body 1 reflected through the origin, so at this instant all 3 bodies lie on a single straight line with body 3 at its midpoint. Every separation follows from that, with no second square root.

      r2=βˆ’r1⟹r13=r23=1.0000,r12=2.0000\mathbf{r}_2=-\mathbf{r}_1\quad\Longrightarrow\quad r_{13}=r_{23}=1.0000,\qquad r_{12}=2.0000
    3. Newton's law now needs nothing but those separations. Body 3 is 1 unit from each of the others, while bodies 1 and 2 are twice as far apart, so the pull between them is weaker by a factor of 4.

      Fij=Gmimjrij2⟹F12=122=0.2500,F13=F23=1.0000F_{ij}=\frac{Gm_im_j}{r_{ij}^{2}}\quad\Longrightarrow\quad F_{12}=\frac{1}{2^{2}}=0.2500,\qquad F_{13}=F_{23}=1.0000
    4. Spend the collinearity. Body 3 is pulled equally in opposite directions, so its net force vanishes exactly. Bodies 1 and 2 are pulled the same way by both partners, because body 3 sits between them, so their 2 forces add as plain numbers with no components to resolve.

      ∣F3∣=1.0000βˆ’1.0000=0.0000,∣F1∣=1.0000+0.2500=1.2500|\mathbf{F}_3|=1.0000-1.0000=0.0000,\qquad |\mathbf{F}_1|=1.0000+0.2500=1.2500
    5. Zero total momentum, plus bodies 1 and 2 moving identically, pins body 3's velocity at βˆ’2v1. That makes its kinetic energy 4 times theirs, and the sum over all 3 collapses to a single term.

      βˆ‘mivi=0,Β v1=v2 ⟹ v3=βˆ’2v1,Β Β KE=12(1+1+4)v12=3v12{\textstyle\sum}m_i\mathbf{v}_i=0,\ \mathbf{v}_1=\mathbf{v}_2\ \Longrightarrow\ \mathbf{v}_3=-2\mathbf{v}_1,\ \ KE=\tfrac12(1+1+4)v_1^{2}=3v_1^{2}
    6. Squaring the 2 components of v1 and tripling is the whole of the kinetic-energy calculation for 3 bodies.

      v12=0.4662036852+0.432365732=0.404286⟹KE=1.2129v_1^{2}=0.466203685^{2}+0.43236573^{2}=0.404286\quad\Longrightarrow\quad KE=1.2129
    7. Potential energy needs no vectors either β€” just the reciprocals of the 3 separations, and with Ξ΅ = 0 those reciprocals are exact.

      PE=βˆ’G(m1m22+m1m31+m2m31)=βˆ’2.5000PE=-G\left(\frac{m_1m_2}{2}+\frac{m_1m_3}{1}+\frac{m_2m_3}{1}\right)=-2.5000

    Answer

    E = βˆ’1.2871, and every row of the panel's t = 0 table β€” separations, pair forces, net forces, both energies and the total β€” came out of those 4 decimals and the vanishing of the total momentum. Watch what happens to the parts: by t = 25.0 the kinetic energy has climbed to 1.305 and the potential has fallen to βˆ’2.592, and the total has not moved. The sign is what carries a consequence. A bound trio can still lose a member, but not for free: if 1 body drifts away with nothing to spare, the pair left behind has to hold the entire βˆ’1.2871, and 2 unit masses with that energy have a semi-major axis of 1/(2 Γ— 1.2871) = 0.3885 β€” under 1/5 of the 2.0000 that separates them now. Ejection and hardening are the same event, and the energy budget is why.

    E=1.2129βˆ’2.5000=βˆ’1.2871⟹amax⁑=Gm22∣E∣=12(1.2871)=0.3885E=1.2129-2.5000=-1.2871\quad\Longrightarrow\quad a_{\max}=\frac{Gm^{2}}{2|E|}=\frac{1}{2(1.2871)}=0.3885
References (1)