An N-body simulation is a type of computer simulation of planets or stars or other objects and their gravitational interaction. The N-body problem is not generally solvable by equation, so simulation is the means to solutions. A simple N-body simulation might be to calculate the gravitational force on each body and thus its acceleration, then estimate where it will be after a small time increment, then repeat. To handle many bodies, e.g., stars in a simulated galaxy, methods of optimizing this have been devised. Among their uses are cosmological simulations. When the number of bodies is intractably large, approximating the overall effect using a smaller number of bodies can sometimes be effective or other means may also used to model the effects of many closely-interacting bodies. In cosmological zoom simulations, portions of high interest or that defy such simplifications may be modeled with finer detail than the simulation at large. Example software:
Some software that also includes hydrodynamics:
An example simulation is Millennium Run.
A very early N-body simulation was carried out in 1941 by Eric Holmberg using an analog method: light bulbs represented the bodies, using the light as an analog of the inverse square law-force of gravity, and adjusting the positions of all the light bulbs after measuring light received and determining net forces.