\documentclass[12pt]{article}
\usepackage{fullpage,amsmath,amsfonts}

\def\d{{\mathrm d}}

\begin{document}

\title{Nonlinear Dynamics Lab}
\author{Session 7 and 8}
\date{due March 4, 2013}
\maketitle

\begin{enumerate}

\item Consider the equation for the mathematical pendulum
\begin{align*}
  \dot q & = p \\
  \dot p & = - \sin q \,.
\end{align*}
Write a program that solves the mathematical pendulum with
\begin{enumerate}
\item the explicit Euler method,
\item the implicit Euler method,
\item the implicit midpoint method.
\end{enumerate}
Take initial values $q(0)=0$ and $p(0)=1.9$ and plot example solutions
$q(t)$ vs.\ $t$ for each method into one graph for a time horizon of
many oscillation periods.

\item Use your program from Exercise 1 to plot the solution
trajectories in the $q$-$p$ phase plane and overlay it with a contour
plot of the energy
\[
  E = \frac12 \, p^2 - \cos q \,.
\]

\item Read up on the build-in ODE solvers in
\texttt{scipy.integrate.ode}.  Obtain a reference solution for the
mathematical pendulum using one of these integrators for a fixed final
time, e.g.\ $T=10$, and determine the order of the previously
implemented methods by plotting the error (the difference of the
result of your solver vs.\ that of the built-in reference solver) vs.\
the step size on a doubly logarithmic scale.

\item Solve the van der Pol equation
\begin{align*}
  \dot x & = y \,, \\
  \dot y & = \mu \, (1-x^2) \, y - x 
\end{align*}
for $\mu=1000$ with different built-in solvers.  Be sure to involve at
least one explicit solver and one implicit one.

\end{enumerate}

You should submit by the deadline the runable code for each problem as
well as a written description of your observations as well as a
discussion of these observations for Exercises 1/2 (together) and 4.

\end{document}

