For this reason, where simulations are desired, it is necessary to use numeric techniques such as Euler's method to solve the complicated equations resulting. Euler's method is a procedure for solving first order differential equations. The idea is to calculate the behaviour of the system during a small instant of time, add this change to the original values, and calculate again. Since in a differential equation the instant of time approaches zero, the method is more accurate if smaller increments of time are used. Furthermore, error is cumulative, so as more and more calculations are performed, and a tiny error is added at each step, the simulation strays farther and farther from the actual solution.
Various techniques are available for improving the accuracy of the method.
The program listing is too long to be included here, but I will give an explanation of how the calculations were performed. All the information was stored in ten arrays, in which the bodies were assigned a place, such that the ith number in each array always referred to the ith body. Bodies were assumed to be spherical, and of uniform density and negligible volume. The editing environment used to produce the program was Borland Pascal ver. 7.0, running on an IBM PC compatible 486 computer.