Z. The former equation (gravitation) may look foreboding, but its calculation is no problem. The latter equations (motion laws) seem simpler, but yet they cannot be calculated. Computers cannot integrate, they cannot work with infinitesimal values, so instead of dt we use Δt and bringing the resulting variable to the left: , and: Remember that a is still a function of time. The simplest way to solve these is just the Euler algorithm, which in essence is the linear addition described above. Limiting ourselves to 1 dimension only in some general computer language: a.old = gravitationfunction(x.old) x.new = x.old + v.old * dt v.new = v.old + a.old * dt As in essence the acceleration used for the whole duration of the timestep, is the one as it was in the beginning of the timestep, this simple method has no high accuracy. Much better results are achieved by taking a mean acceleration, the average between the beginning value and the expected (unperturbed) end value: a.old = gravitationfunction(x.old) x.expect = x.old + v.old * dt a.expect = gravitationfunction(x.expect) v.new = v.old + (a.old + a.expect) * 0.5 * dt x.new = x.old + (v.new + v.old) * 0.5 * dt Of course still better results can be expected by taking intermediate values. This is what happens when using the Runge-Kutta method, especially the one of grade 4 or 5 are most useful. The most common method used is the leapfrog method due to its good long term energy conservation. A completely different method is the use of Taylor series. In that case we write: but rather than developing up to some higher derivative in r only, one can develop in r and v (that is r') by writing and then write out the factors f and g in a series. Approximations To calculate the accelerations the gravitational attraction of each body on each other body is to be taken into account. As a consequence the amount of calculation in the simulation goes up with the square of the number of bodies: Doubling the number of bodies increases the work with a factor four. To increase the accuracy of the simulation not only more decimals are to be taken but also smaller timesteps, again quickly increasing the amount of work. Evidently tricks are to be applied to reduce the amount of work. Some of these tricks are given here. By far the