 Types of N-body ODE Integration Methods
June 9, 1996
30
2.0 Types of N-body ODE Integration Methods
There are many different methods that can be used to solve the differential equa-
tion
and thus can be used to calculate the movement of the stars. We have
already mentioned some of them in passing, Euler's method and the Taylor series expan-
sion in particular. There are also many others and in this section a few of them will be sur-
veyed
In Section 1.4.1 on page 20, three areas of efficiency were discussed, the first of
which was how efficiently a system uses the results of the evaluation of the force function
f()
. Section 1.7 on page 27 discussed how you can not simply look at the order of a method
that solves an ODE to determine which method is best. Any one of these methods could be
the most efficient method, depending on the circumstances of the particular star system.
A word of caution about the methods described in this section: the formulas as pre-
sented are usually playing fast and loose with notations and descriptions. In particular,
they are usually presenting solutions to the equation
as this is how these
formulas are normally presented in numerical analysis books, and also because it simpli-
fies many of the formulas. Converting these methods into something that can be used to
solve the N-body ODE can sometimes be tricky.
As was mentioned in Section 1.5.6 on page 26, detecting program bugs can be
very hard to do. As an example, I implemented the Runge-Kutta method (See 2.1.3) in
what I thought was the correct method, but in Marciniak's book
(12)
, he implemented it
slightly differently. Instead of each step depending on the previous step, he had the second
step depend only on the velocity. The third step was then dependant on the first step and
the fourth and final step was dependant on the second step. Marciniak's implementation of
the Runge-Kutta method turns out to be very slightly more efficient than mine. S, be
careful if you try to implement an N-body program.
2.1 One Step Methods
The Euler's method, the Taylor series and Runge-Kutta's methods are all classified
as "one step methods" because they calculate
x(t+h)
using only the initial starting point
x(t)
and consider only the time period from
t
to
t+h
. They solve the integration of
f()
over
the entire evolution of the star system "one step" at a time. This is an important property
and other methods, such as the multi-step methods, often use one-step methods to build up
the "history" of
x
values.
(12:14,1:302,366)
2.1.1 Euler's Method (-m euler1)
x
''
t
( )
f x t
( )
(
)
=
x
'
t
( )
f x t
( )
(
)
=
x t h
+
(
)
x t
( )
hf x t
( )
(
)
+
=
E
12
h
2
f
'
( )
=