Solve the equation of orbital motion (see Exercise 13) using the fourth order Runge-Kutta method.
The 4th order Runge-Kutta Method method was described in Lecture and is summarized below for the first order equation:
The value at the next time step is found from:
where
To solve this equation, we need to supply initial conditions. Let the calculation start at x=1 AU, y=0 AU, and z=0 AU. Let the initial velocity in the x and z directions be 0, and write a script that solves this differential equation for an initial velocity in the y direction that is input by the user.
Please make a subdirectory for this exercise under your
directory ~schloerb/ph281/username and then copy the
following into that subdirectory:
Consider the accuracy of the 4th order Runge-Kutta method compared to the
2nd order Runge-Kutta method. Using a circular orbit as a metric, compare the
ability of the two methods to complete one orbit and return precisely to the
originating point. Make a graph of the error after one orbit versus time
step size for the two methods.
Extra Credit