Lab Exercises )
Exercise 1.
Solve this wikipedia example of a stiff ODE,
dr/dt = -15*r; r(0)=1.0,
from t=0 to t=1.0 with scipy's odeint and a forward Eulerian
method with a small # of time steps (e.g., 8).
Exercise 2.
Solve this set of equations with forward and backward (implicit) Euler methods,
as well as canned scipy.integrate's odeint:
d^2x/dt^2 = -c dx/dt - k x
x(t=0)=1, dx/dt|_t=0 = 0
Solve out to t=1.0.
Exercise 3.
Solve for the Earth's orbit about the Sun using a forward Eulerian
scheme and a leapfrog integrator for t=1 year. For definiteness, start
the Earth on the x-axis at a=1 AU and give it a velocity in the y-dir
of sqrt(GM/a), where G is Newton's constant and M is the mass of the
Sun. Compare before/after energies in these two cases.
In case it is useful, in cgs units G=6.67408e-8, M=1.9885e33
g, and 1 AU=1.4959787e13 cm.