Celestial Mechanics on a Graphing Calculator
2. Euler's method
For the restricted 2body problem, some important simplifications
can be introduced in the equations expressing Newton's laws.
 The larger body may be assumed to remain at rest, and its
position may then be chosen as the origin of the coordinate system.
So in the equations we may take x' = 0.
 The motion of the smaller body must lie in the plane
determined by its initial velocity direction and the position
of the larger body. So the system is only 2dimensional. For
obvious reasons we exclude the case in which the initial velocity
vector points exactly at the larger body.
 Finally, we can rescale the space and time coordinates to
make the constant Gm' equal to 1. For example, to interpret
these calculations in terms of the motion, in our solar system,
of a planet at approximately one earthorbit radius, the
unit of length would correspond to 7.2x10^{10}m
(approximately 45 million miles), and the unit of time to
1.7x10^{6} seconds, approximately 19 days.
We are left with the following system of differential equations,
where x and y are the components of the
position vector x of the smaller body, and v,w
are the corresponding components of its velocity vector v.
Note that d, the distance between the two bodies,
is now (x^{2}+y^{2})^{1/2}.
dx
 = v
dt
 dv x
 = 
dt (x^{2}+y^{2})^{3/2}

dy
 = w
dt
 dw y
 = 
dt (x^{2}+y^{2})^{3/2}

Euler's method (Leonhard Euler, 17071783) is the most elementary numerical way of attacking
a system of differential equations. The algorithm takes as input
the equations, the length of time T over which a solution is to
be approximated, the number n of steps desired for the approximation,
and initial values x_{0}, y_{0}, v_{0},
w_{0} for the four unknown functions.
The method consists in iterating n times the following calculation,
starting with i = 0; dt is the time increment T/n.
x_{i+1} = x_{i} + v_{i} dt
 x_{i}
v_{i+1} = v_{i} +  dt
(x_{i}^{2}+y_{i}^{2})^{3/2}

y_{i+1} = y_{i} + w_{i}dt
 y_{i}
w_{i+1} = w_{i} +  dt
(x_{i}^{2}+y_{i}^{2})^{3/2}

Unfortunately, while in theory Euler's method can give any desired
accuracy provided the number of steps is big enough, that number of
steps can be impractically large. For example, here is what happens
when one applies Euler's method on a TI82 graphing calculator
to the restricted 2body problem,
as given above, with x_{0}=2, y_{0}=0, v_{0}=0,
w_{0}=.68, T=20 and n=1000.
The ellipse does not close up. Doubling the number of steps takes
twice as long but still does not give a closed image.
Comments: webmaster@ams.org
@ Copyright 2001, American Mathematical Society.