N-body simulation

This quantity need not have any physical significance, but must be chosen as a compromise between accuracy and manageable computer requirements.

The time evolution of the density f (in phase space) of dark matter particles, can be described by the collisionless Boltzmann equation

These calculations are used in situations where interactions between individual objects, such as stars or planets, are important to the evolution of the system.

The first direct gravitational N-body simulations were carried out by Erik Holmberg at the Lund Observatory in 1941, determining the forces between stars in encountering galaxies via the mathematical equivalence between light propagation and gravitational interaction: putting light bulbs at the positions of the stars and measuring the directional light fluxes at the positions of the stars by a photo cell, the equations of motion can be integrated with ⁠

[4] The first purely calculational simulations were then done by Sebastian von Hoerner at the Astronomisches Rechen-Institut in Heidelberg, Germany.

Sverre Aarseth at the University of Cambridge (UK) has dedicated his entire scientific life to the development of a series of highly efficient N-body codes for astrophysical applications which use adaptive (hierarchical) time steps, an Ahmad-Cohen neighbour scheme and regularization of close encounters.

Regularization is a mathematical trick to remove the singularity in the Newtonian law of gravitation for two particles which approach each other arbitrarily close.

Sverre Aarseth's codes are used to study the dynamics of star clusters, planetary systems and galactic nuclei.

[citation needed] Many simulations are large enough that the effects of general relativity in establishing a Friedmann-Lemaitre-Robertson-Walker cosmology are significant.

N-body simulations are simple in principle, because they involve merely integrating the 6N ordinary differential equations defining the particle motions in Newtonian gravity.

In practice, the number N of particles involved is usually very large (typical simulations include many millions, the Millennium simulation included ten billion) and the number of particle-particle interactions needing to be computed increases on the order of N2, and so direct integration of the differential equations can be prohibitively computationally expensive.

For simulations where particles are not evenly distributed, the well-separated pair decomposition methods of Callahan and Kosaraju yield optimal O(n log n) time per iteration with fixed dimension.

The fast Fourier transform can solve this efficiently by going to the frequency domain where the Poisson equation has the simple form

Several different gravitational perturbation algorithms are used to get fairly accurate estimates of the path of objects in the Solar System.

This can introduce problems with short-range interactions between the particles such as the formation of two-particle binary systems.

To prevent this, a softened Newtonian force law is used, which does not diverge as the inverse-square radius at short distances.

Instead, it displays a structure resembling a network, consisting of voids, walls, filaments, and halos.

Simulations that model both dark matters and baryons are needed to study small-scale structures.

Incorporating baryons, leptons and photons into the simulations dramatically increases their complexity and often radical simplifications of the underlying physics must be made.

Reif and Tate[6] prove that if the n-body reachability problem is defined as follows – given n bodies satisfying a fixed electrostatic potential law, determining if a body reaches a destination ball in a given time bound where we require a poly(n) bits of accuracy and the target time is poly(n) is in PSPACE.

On the other hand, if the question is whether the body eventually reaches the destination ball, the problem is PSPACE-hard.

In object-oriented programming languages, such as C++, some boilerplate code is useful for establishing the fundamental mathematical structures as well as data containers required for propagation; namely state vectors, and thus vectors, and some fundamental object containing this data, as well as the mass of an orbiting body.

In systems such as those dependent on some gravitational or electric potential, the force on a simulation entity is independent on its velocity.

Consider a planet orbiting a star- it has no motion, but is subject to gravitational attraction to its host star.

, the resultant acceleration of a body due to its neighbouring masses is independent of its velocity, however, for the time step

is static, however, from the perspective of an observer seeing only position, it will take two time steps to see a change in velocity.

A solar-system-like simulation can be accomplished by taking average distances of planet equivalent point masses from a central star.

An entire simulation can consist of hundreds, thousands, millions, billions, or sometimes trillions of time steps.

At the elementary level, each time step (for simulations with particles moving due to forces exerted on them) involves The above can be implemented quite simply with a while loop which continues while

exists in the aforementioned range: Focusing on the inner four rocky planets in the simulation, the trajectories resulting from the above propagation is shown below:

An N -body simulation of the cosmological formation of a cluster of galaxies in an expanding universe
N-body simulation of 400 objects with parameters close to those of Solar System planets