In this paper we describe a new algorithm for the long-term numerical
integration of the two-body problem, in which two particles interact u
nder a Newtonian gravitational potential. Although analytical solution
s exist in the unperturbed and weakly perturbed cases, numerical integ
ration is necessary in situations where the perturbation is relatively
strong. Kustaanheimo-Stiefel (KS) regularization is widely used to re
move the singularity in the equations of motion, making it possible to
integrate orbits having very high eccentricity. However, even with KS
regularization, long-term integration is difficult, simply because th
e required accuracy is usually very high. We present a new time-integr
ation algorithm which has no secular error in either the binding energ
y or the eccentricity, while allowing variable stepsize. The basic app
roach is to take a time-symmetric algorithm, then apply an implicit cr
iterion for the stepsize to ensure strict time reversibility. We descr
ibe the algorithm in detail and present the results of numerical tests
involving long-term integration of binaries and hierarchical triples.
In all cases studied, we found no systematic error in either the ener
gy or the angular momentum. We also found that its calculation cost do
es not become higher than those of existing algorithms. By contrast, t
he stabilization technique, which has been widely used in the field of
collisional stellar dynamics, conserves energy very well but does not
conserve angular momentum. (C) 1996 American Astronomical Society.