Solution of the N-Body Problem with 12-order Runge-Kutta in C using parallel processors with ALL-Pairs algorithm.
Given bodies in an inertial reference frame in
with an initial position
and velocity
for
, the force vector
on body
caused by its gravitational attraction to body
is given by the following equation:
Where and
are the masses of the bodies
and
respectively; and
is the distance between the position vectors.
Summing over all masses yields the
-body equations of motion:
where is the self-potential energy
The computation has two steps:
- Compute the forces on each element
- Move each element a bit based on this force, and then repeat
Since each object computes the forces on it from each other object ( objects). Thus, the work complexity of this problem is a
algorithm. Each object must compute its interaction with each other object so each of
objects has to compute
forces.