5

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?

Jorge Rodriguez
  • 547
  • 2
  • 9
  • 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 05 '16 at 02: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 05 '16 at 18:14
  • 2
    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 05 '16 at 18:23

2 Answers2

2

EDIT: TL:DR Jorge's question was "I thought the symplectic Euler was O[1], how is it producing an O[2]?" and my answer is "well because you've combine a symplectic Euler update with its time shifted (aka adjoint) counterpart. So you're not really looking at the symplectic Euler anymore."

#---------- Extended Answer -----------#

This was a very interesting question. I think in your derivation you have done a thing that makes your "symplectic Euler" NOT a symplectic Euler. The Velocity Verlet, is known to be the composition of 2 symplectic Euler methods. Knowing this helped me recognize what had happened in your proof. (See "Geometric Numerical Integration" by Hairer - ChVI theorem 3.4)

Let's start with your definition of symplectic Euler method $$v_{n+1} = v_n + ha_n$$ $$x_{n+1} = x_n + hv_{n+1}$$

In your derivation you do the following \begin{align} \text{line 1: } && x_{n+1} &= x_n + hv_{n+1} \\ \text{line 2: }&& &= x_n + h(v_n + ha_n) \\ \text{line 3: }&& &= x_n + h\left(\frac{x_n - x_{n-1}}{h} + ha_n\right) \\ \text{line 4: }&& &= 2x_n - x_{n-1} + h^2a_n \end{align}

Moving from Line 2 to line 3 you insert a $v_n$. The velocity has an explicit update $v_{n+1} = v_n + h a_n$. However to arrive at $v_n$ you use do NOT use $v_n = v_{n-1} + h a_{n-1}$. Rather you reconfigure the implicit position $x_{n+1}=x_n+hv_{n+1}$. So you aren't using the same mapping $\phi$ from $v_{n-1} \rightarrow v_n$ as you are from $v_{n} \rightarrow v_{n+1}$. In equations this looks like, $\phi_a(v_{n-1}) = v_n$ and $\phi_b(v_n) = v_{n+1}$. Where, the mappings are related as $\phi^*_a = \phi_b$ so you (unknowingly) constructed a Verlet update $\phi^*_a \circ \phi_a$.

ThomasTuna
  • 439
  • 6
  • 13
  • Comments are not for extended discussion; this conversation has been moved to chat. – TheSimpliFire Mar 28 '22 at 12:50
  • Your general idea is wrong. Just apply the same chain of reasoning to the Euler method. The adjoint of implicit Euler is explicit Euler, consider a sequence of implicit Euler steps and position yourself at index $n$. Going from index $n$ to $n-1$ is the application of explicit Euler with negative time step, going from $n$ to $n+1$ implicit Euler, so the combination should give a time-invariant step of double step size? No, the combined step is still two implicit Euler steps which is not invariant under time reversal. – Lutz Lehmann Mar 28 '22 at 13:14
0

Let's contrast the semi-implicit or symplectic Euler method with the leapfrog Verlet method $$ v_{n+1/2}=v_{n-1/2}+h·a(x_n)\\ x_{n+1}=x_n+h·v_{n+1/2} $$ Structurally this is very similar to the symplectic Euler method, only that the velocity sequence is leapfrogged (by half the step size) in its location relative to the position sequence.

Reduced to the sequence of the $x_n$, both methods follow the Verlet formula. One can get to the leapfrogged variant by going backwards from the Verlet formula, substituting position differences by the velocities using central divided differences.

Leapfrog Verlet has order 2 due to the use of 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)$. In contrast the local error $O(h^2)$ of the non-symmetric difference quotients of the Euler methods leads to $O((e^{Lt}-1)·h)$ globally.

From a computational point-of-view, the only difference is in the first step (or even directly before that), the preparation of the initial values. 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)$. 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 (which are the values computed in velocity Verlet).


The other way around, consider how the start of the one-step methods translate to the start of the multi-step Verlet method, that is, the value of $x_1$. 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 leapfrog Verlet value $$ v_{+1/2}=v_{-1/2}+h·a(x_0)=v_0+\frac{h}2a(x_0)\\ x_1=x_0+h·v_{+1/2}=x_0+h·v_0+h^2/2·a_0 $$

Lutz Lehmann
  • 131,652
  • 1
    so is the differnce only in the initial conditions effectively? – guillefix Apr 23 '20 at 21:59
  • @guillefix : Yes, that is why it is frequently "rediscovered" due to an error in coding the Euler method and the observation of the surprisingly good results. That is, the error gives the symplectic Euler method and the closeness to Verlet the surprisingly good physical behavior. – Lutz Lehmann Apr 23 '20 at 22:11
  • Would it be possible to add an explanation of exactly what you mean by the words "local error" and "global error"? I was with you up until those words, then got completely lost. – Don Hatch May 14 '25 at 21:23
  • @DonHatch : The local error is the truncation error of the method step or the residual when you insert the values of an exact solution into the method step equation. The global error is the accumulated result of all the local errors. In a first approximation it is the sum, in the long term some compounding factors have to be included. With Verlet you have a second order difference equation, so the global error results from a double summation, giving a difference of 2 in the local and global error orders.. – Lutz Lehmann May 15 '25 at 08:11