One of the simplest problem in classical physics is that of the motion of a small mass influenced by the gravitational field generated by another heavy mass. The latter approximately remains stationary under the assumption that it is very large. The exact solution of this one-body system for negative total energy predicts that the small mass will follow an elliptical orbit with ne of its foci located at the heavy mass location. The orbit remains in a plane whose direction is specified by the initial conditions.
This seemingly simple problem can become a challenge when
solved numerically. This stems from the very singular
nature of the gravitational potential which diverges
as
as the distance between the masses,
, becomes
small. When the small mass approaches close from
the heavy mass, the gravitational field can cause
extremely large curvature in its orbit.
Said in another way, the orbits possessing
high ellipticity will likely be hard to compute
numerically, even when using a method as accurate as
the Runge-Kutta 4th order scheme.
This system is conservative, namely the total energy
is a constant of the motion. A warning
of the poor performance of the ODE numerical integration
will be the lack of constancy of what should be
constants of the motion, like the total energy
.
This has led to the development of new methods for ODE numerical integration which are specially derived in order to maintain the constants of the motion really constant. We will see some of these methods in the following sections.
First, let's illustrate the problem. The gravitational
model above will be used to do so. Let the mass
be
in the gravitational potential of a large mass
The product
The mass
follows trajectories in a 4 dimensional phase space (not 6),
,
,
and
, since the motion is in a plane (exact).
Newton equations lead to
![]() |
![]() |
||
![]() |
![]() |
||
![]() |
![]() |
||
![]() |
![]() |
The program
orbit.c
implements the solution of the
this problem using the Runge-Kutta 4th order ODE integration scheme.
The mass
is assumed at some arbitrary position
(
should be used to simplify coding) as an example of how to code
a real two body system.
The mass
initial position is taken at
and
where
is arbitrary
and its velocity as
and
where
is arbitrary.
Larger values of
produce small excentricity orbits for which
RK4 is very accurate. Check the orbit in
and
for closure
and the energy as a time series for constancy.
Smaller values of
produce higher excentricity orbits for which
RK4 ceases to be accurate. Check the orbit in
and
for closure
and the energy as a time series for constancy.
Of course, smaller
would improve accuracy. But the point is
that larger excentricity orbits would eventually lead to inaccuracies .
These concerns will be addressed in the next sections.