Write a program to integrate any number of coupled differential equations using the Euler method, fourth-order Runge-Kutta, and Leapfrog (note: Leapfrog only applies to special cases). You will be using this program in a future assignment, so make sure it's well documented. It's recommended that you use double precision throughout.

- Use your program to solve the following differential equation
for :

with initial conditions , . Note the analytical solution is .- Integrate the equation for using each of the methods, and step sizes of 1, 0.3, 0.1, 0.03, and 0.01.
- Plot your integration results against the analytical solution
for each case. (
*Hint*: do all the Euler plots on one page, with one plot per timestep; then all the Leapfrog plots on another page, etc.) Comment on the results. - Plot
as a function of
in each case and comment. (
*Hint*: does the error have the expected dependence on the stepsize? Remember you're integrating over many steps, not just one.)

- Now try the two-dimensional orbit described by the potential:

where we are assuming unit mass for the particle in this potential. Show analytically that the orbits are given by the coupled differential equations:

and then reduce these to 4 coupled first-order equations.- Integrate this system for
with the initial
conditions , , , . Try
this with Leapfrog and Runge-Kutta, and step sizes of 1, 0.5,
0.25, and 0.1. Plot
*vs*. for these integrations. - Plot the energy as a function of time for your integrations.

- Integrate this system for
with the initial
conditions , , , . Try
this with Leapfrog and Runge-Kutta, and step sizes of 1, 0.5,
0.25, and 0.1. Plot
- Plot phase diagrams (
*vs*. ) for the Lotka-Volterra Predator-Prey model: