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.
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.