What happens to the $O(\cdot)$ terms when we implement the Leapfrog Integration algorithm in a programming language?

55 Views Asked by At

The Verlet leapfrog algorithm is an economical version of the basic algorithm, in that it needs to store only one set of positions and one set of velocities for the atoms, and is even simpler to program.

The equations defining this algorithm are as follows:

  • ${{v_{{n}+{\frac{1}{2}}}}} = v_{{n}-{\frac{1}{2}}} + \frac{f_n}{m} \triangle t + \mathcal{O} (\triangle t^3)$
  • $r_{{n}+{1}} = r_{{n}} + v_{n + \frac{1}{2}} \triangle t + \mathcal{O} (\triangle t^4)$
  • $v_n = \frac{1}{2} \left[ v_{n + \frac{1}{2}} + v_{n=\frac{1}{2}} \right] + \mathcal{O} (\triangle t^2)$

What happens to the $O(\cdot)$ terms when we implement the Leapfrog Integration algorithm in a programming language?

Do we discard them?

1

There are 1 best solutions below

0
On BEST ANSWER

Your source overloads the notation and uses the same symbols to denote both the solution of the ordinary differential equation and the numbers produced by the algorithm. This is common abuse of notation that should be avoided as it can confuse new readers. The stated equations do not define the leap-frog algorithm, rather the solution $t \rightarrow (r(t),v(t))$ of the following system of ordinary differential equation $$r'(t) = v(t), \quad mv'(t) = f(t)$$ satisfies the stated equations. You obtain the algorithm by removing the error terms and defining new symbols $p$ and $q$, as in $$\begin{align} p_{n+\frac{1}{2}} &= p_{n - \frac{1}{2}} + \frac{f_n}{m} \Delta t, \\ q_{n+1} &= q_n + p_{n+\frac{1}{2}} \Delta t, \\ p_{n} &= \frac{1}{2} \left( p_{n-\frac{1}{2}} + p_{n + \frac{1}{2}}\right). \end{align}$$ In the absence of any stability issues $p_n \approx v(t_n)$ and $q_n \approx r(t_n)$ are good approximations. The advantage of choosing new symbols is that we clearly distinguish between the solution of the differential equation and the output of the algorithm used to compute our approximations. If we worry about rounding errors, then we can use $\hat{p}_n$ and $\hat{q}_n$ to refer to the computed values of $p_n$ and $q_n$.