# Leapfrog Integration

## Required Reading

## The Leapfrog Method

Consider a system of coupled ordinary differential equations of the form

\begin{equation} \eqalign{ \frac{df}{dx} &= g(x, k(x)) \cr \frac{dk}{dx} &= h(x, f(x)). } \label{coupled} \end{equation}

The simplified Midpoint method can be exploited to solve these equations.

First, advance $f$ by half a step to get $f(x_{1/2})$:

\begin{equation} f(x_{1/2}) = f(x_0) + \frac{\Delta x}{2} \cdot g(k(x_0)). \label{leapfrog1} \end{equation}

Then, repeat the following until $x = x_{\text{final}}$:

\begin{equation} \eqalign{ k(x_{i+1}) &= k(x_i) + \Delta x \cdot h(f(x_{i+1/2})) \cr f(x_{i+3/2}) &= f(x_{i+1/2}) + \Delta x \cdot g(k(x_{i+1})). } \label{leapfrog2} \end{equation}

In this way, $f$ always stays a half step ahead of $k$. To evaluate the solution, a final half step must be taken by $k$ in order to bring both $f$ and $k$ to a common $x$.