
Celestial Mechanics on a Graphing Calculator
dx -- = v dt | dv -x -- = --------- dt (x2+y2)3/2 |
dy -- = w dt | dw -y -- = --------- dt (x2+y2)3/2 |
Euler's method (Leonhard Euler, 1707-1783) 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 x0, y0, v0, w0 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.
xi+1 = xi + vi dt |
-xi
vi+1 = vi + --------- dt
(xi2+yi2)3/2
|
yi+1 = yi + widt |
-yi
wi+1 = wi + --------- dt
(xi2+yi2)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 TI-82 graphing calculator to the restricted 2-body problem, as given above, with x0=2, y0=0, v0=0, w0=.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.