One star, one arrow, and the laws fall out by hand.
Click anywhere near the star to nock a planet. Pull the cursor back like a bowstring and release — the planet flies off in the opposite direction with the speed you gave it. Aim short and it falls back as an ellipse; aim long and it slips the star's grip entirely. Three of Kepler's observations are waiting for you on the other side of a few good throws.
What you are looking at
§ 07 · Reading4π²/GM.How the simulation behaves
§ 07 · Method
Newton's law gives every planet a pull of a = −GM r̂ / r² toward the
star. The state (x, v) is integrated with a velocity Verlet
(leapfrog) step — symplectic, so the energy doesn't slowly drift the way a naive
Euler step would. After a few orbits you can see the difference: the path closes
onto itself instead of spiraling.
Orbital elements are read off the state at every instant. Specific energy
E = ½v² − GM/r sets the semi-major axis a = −GM/(2E);
the Laplace–Runge–Lenz vector gives the eccentricity e and the
direction to perihelion. For bound orbits we draw the ellipse and, on toggle,
both foci — empty one and all.
Periods are measured, not assumed: each time a planet passes through perihelion (the radial velocity changing from negative to positive) we record one orbit (T, a). Those pairs feed the little plot on the right. Throw any number of planets at any radius and watch the data assemble itself into the cleanest line in physics.