I could dwell on the best laid plans but I’m starting to sound like a broken record, so rather than wasting any more time, let’s get on with it. We have n bodies we want to manage. Gravitation and the laws of motion give us some basic tools for approaching the solution but there are a few other problems to work out along the way.
This defines the gravitational force between two masses, m1 and m2. There’s a fudge factor of proportionality, G, whose value varies depending on the units of measure being used for the calculations. Otherwise, the force between the masses is directly proportional to the product of their masses and inversely proportional to the square of the distance between them.
These formulæ define the relationships between position, velocity, acceleration and time of our masses in motion. One more equation completes the set:
Operating in a dimensional space, these equations express relationships among vectors, as noted by the arrows. The first equation defines the forces between the bodies (which we’ll simplify to point masses—everything concentrated at one tiny spot—and we’ll ignore collisions). The last equation couples those forces to the accelerations that drive the motions in the middle set.
Bodies move continuously under the constant effect of these forces. We can approximate this motion by picking a discrete time step wherein we measure forces and apply their effect. This is a better or worse approximation depending on the size of the steps and the severity of curvature, which happens when the forces are greater. Already then we’ve identified the basic elements of our loop: compute forces between bodies, then apply them to the bodies.
Next time: body data