# Are S.I. Euler and Verlet the same thing?

Verlet as given by Wikipedia:

• set $\vec x_1=\vec x_0+\vec v_0\,\Delta t+\frac12 A(\vec x_0)\,\Delta t^2$
• for ''n=1,2,...'' iterate $\vec x_{n+1}=2 \vec x_n- \vec x_{n-1}+ A(\vec x_n)\,\Delta t^2.$

S.I. Euler as given by Wikipedia:

$v_{n+1} = v_n + g(t_n, x_n) \, \Delta t\\ x_{n+1} = x_n + f(t_n, v_{n+1}) \, \Delta t$

Starting with S.I. Euler (and simplifying the notation):

$$x_{n+1} = x_n + hv_{n+1} \implies v_n = \frac{x_n - x_{n-1}}{h}\\ x_{n+1} = x_n + hv_{n+1} = x_n + h(v_n + ha_n) = x_n + h\left(\frac{x_n - x_{n-1}}{h} + ha_n\right) = 2x_n - x_{n-1} + h^2a_n$$

OK so they're the same thing, cool. That matches my tests (some simple projectile stuff + wind resistance + weird acceleration functions) where Verlet and SI Euler perform to within floating point error. However the Verlet page says, "The global error of all Euler methods is of order one, whereas the global error of [Verlet] is, similar to the midpoint method, of order two." It also says, "The global error in position, in contrast, is $O(\Delta t^{2})$ and the global error in velocity is $O(\Delta t^{2})$." The SI Euler page says "The semi-implicit Euler is a first-order integrator, just as the standard Euler method." How can they have different orders when they are the same method and seem to produce identical results?

• It appears to me your treatment of semi-implicit Euler is only for a quite special case $f(t_n,v_{n+1}) = v_{n+1}$ and constant time steps $\Delta t = h$. Where it is stated that "all Euler methods" or in particular the semi-implicit Euler method are order one/"first-order" integrators, this is with regard to arbitrary smooth data $f,g$. It is possible that special $f,g$ may allow better accuracy. – hardmath Jul 5 '16 at 2:12
• Good point, my math above assumed the special case. But it still doesn't explain why the two simulations are so close. I've tried every crazy function for $a$ and $g(t_n, x_n)$ that I can think of, including accelerating away from a user-movable point with a strength of $e^x$, which should have lots of terms, so I should have plenty of truncation error. – Jorge Rodriguez Jul 5 '16 at 18:14
• I realize the context is clear to you, but you've jumped into solving some problem using both methods and present the unexpected agreement as a puzzle to explain. You'd be helping your Readers if you back up and state the original problem that is being discretized/approximately solved. – hardmath Jul 5 '16 at 18:23

The difference is that, if you go backward with you calculation, then Verlet is Leapfrog integration relative to the symplectic Euler methods, $$v_{n+1/2}=v_{n-1/2}+h·a(x_n)\\ x_{n+1}=x_n+h·v_{n+1/2}$$ which suggests order 2 by both being midpoint formulas. And indeed the local discretization error $O(h^3)$ translates to a global error $O((e^{Lt}-1)·h^2)$ where $L^2$ is a Lipschitz constant of $a(x)$ while the local error $O(h^2)$ of the Euler methods leads to $O((e^{Lt}-1)·h)$ globally.
So in the end the difference in the implementation is the first step, in symplectic Euler you take the pair $x_0,v_0$ while for Leapfrog you would need to use $x_0, v_{-1/2}=v_0-\frac12h·a(x_0)$ for the initial state. And of course the results have to be interpreted accordingly, i.e., use $v_n=\frac12(v_{n-1/2}+v_{n+1/2})$ in energy computations.
The other way around, compare the first positions that you need to initialize the multi-step method. Symplectic Euler gives you $$v_1=v_0+h·a_0 \\ x_1=x_0+h·v_0=x_0+h·v_0+h^2·a_0$$ which is only correct to first order versus the second order accurate Verlet value $$x_1=x_0+h·v_0+h^2/2·a_0$$