Every body pulls on every other.
Point a telescope at almost anything and you are looking at an unsolved problem. Two stars circling each other trace a clean, predictable ellipse, which Newton worked out in the 1680s. Add a third body and the tidy math falls apart. There is no formula that tells you where three or more gravitating masses will sit far in the future. You have to simulate them, one small step at a time.
the one lawEverything starts from a single rule. Newton’s law of gravitation says every pair of masses pulls on each other along the line between them. The pull grows with the masses and shrinks with the square of the distance.
Read the formula as a sentence. The two masses on top mean heavier things pull harder. The r² on the bottom means the pull fades fast: move twice as far apart and it drops to a quarter. That one attractive tug is the entire physics of the problem. Everything else is just having a lot of bodies do it at once.
add them upA body never feels just one pull. It feels all of them at the same time. To find how it moves we use acceleration = force / mass, and we add up the tug from every other body.
Do not let the symbols intimidate you. Each piece inside the sum is just “point toward another body, with a strength set by the inverse-square law.” The Σ, a Greek capital sigma, means “add those little arrows together.” What comes out is one net arrow: the direction this body speeds up, right now. Do that for every body and you know how the whole cloud moves for one instant.
why three is hardWith two bodies you get two arrows and a clean orbit you can write on paper. With many bodies, every one pulls on every other, so the bookkeeping grows with the square of the count. And from three bodies onward the motion turns chaotic: shift a starting position by a hair and the entire future rearranges.
This is not a gap in our cleverness. Henri Poincaré proved in the 1890s that no neat formula can ever capture three or more bodies in general. The future is still completely determined by the present, it just cannot be shortcut. The only honest way to find out what happens is to play it forward.
how we cheatIf there is no formula, we fall back on arithmetic. Slice time into tiny steps of size Δt. On each step: add up the accelerations, nudge every velocity, then nudge every position, and repeat. Take small enough steps and the path you trace stays faithful to the real one.
This little loop is the whole simulator. The only subtlety is the softening ε: when two bodies nearly collide, their distance heads toward zero and the inverse-square force would explode. The cushion keeps it finite and the simulation stable. Which means you are now ready to read the real thing.
see it runHere is that exact loop, running live on your graphics card. Turn gravity up to 4 and watch a seeded disk find its own structure: spiral arms, dense knots, a slowly turning core. The softening slider is the ε from a moment ago, and bodies is n.
This figure needs WebGPU or WebGL2. Try a current Chrome, Edge, or Safari, or open the full lab.
Every frame, your GPU evaluates that sum of pulls for thousands of bodies against thousands of others, all at once, and never copies a single position back to the main processor. The same math, scaled up with shortcuts like the Barnes-Hut tree to dodge the n² cost, is how astronomers simulate galaxies of billions of stars. It is one of the oldest hard problems in physics, and you just ran it.
Open the full Particle Lab for more models, live measurements, and recording.