A nbody package

Back to Stefan's Astronomical C-program packages page

A nbody package

By Stefan Spännare, January 2003, updated October 2006 and July 2008

Note, the package and the documentation can be downloaded below.


This is a users guide to the nbody package ssnbody. It is not necessary
to understand how the program works just to run it, but some knowledge
in astronomy, mathematics and numerical methods makes it easier. The
program makes a non relativistic (Newtonian) or a relativistic (PPN)
integration of n bodies (point masses). The computation time is
proportional to n², which makes the program useful only up to a few
hundred bodies on a reasonably fast workstation or PC. On the other hand
the integration of the bodies is made with high accuracy using 4-, 5-
or 8-order Runge-Kutta or Bulirsch-Stoer integration. The initial data
for the bodies are usually stored in a ascii file, but the program also
has a simple function for generating random spherical distributions of
bodies. The program package is available for Unix, Linux and DOS under
Windows 98/2000/XP. Some auxiliary programs and plot programs to make
nbody plots are also available. Several easy to use examples are also
included in the package.

There are many reasons for using nbody programs for scientific purposes,
interest and fun. In astronomy it can be of interest to integrate systems
with few bodies i.e. double or multiple stars, the Solar system and
up to whole galaxy simulations with many thousand bodies. The program
package ssnbody is useful for the first kind of simulations when
the number of bodies is relatively small.

Many other software packages for nbody simulations of different kinds
exist, not at least on Internet (see the references).

Some nbody plot examples.

Download the package:

Download the documentation (a users guide, not included in the package):

Article reference (to download):

Some useful Internet references:

Author: Stefan Spännare
E-mail: stefan.sp@outlook.com
Latest update: 2008-07-28