Semi-implicit Euler method explained

In mathematics, the semi-implicit Euler method, also called symplectic Euler, semi-explicit Euler, Euler–Cromer, and Newton–Størmer–Verlet (NSV), is a modification of the Euler method for solving Hamilton's equations, a system of ordinary differential equations that arises in classical mechanics. It is a symplectic integrator and hence it yields better results than the standard Euler method.

Origin

The method was accidentally discovered by Newton North High School senior student Abby Aspel in 1980. In a lab assignment simulating orbits using Kepler's Law, which required computation in BASIC: she accidentally reversed two lines of code by calculating velocity before position. Her simulation converged more quickly and resulted in more accurate and feasible results than what was expected. Alan Cromer then proved why her algorithm was more stable than previous methods of computation[1] .

Setting

The semi-implicit Euler method can be applied to a pair of differential equations of the form

\begin{align} {dx\overdt}&=f(t,v)\\ {dv\overdt}&=g(t,x), \end{align}

where f and g are given functions. Here, x and v may be either scalars or vectors. The equations of motion in Hamiltonian mechanics take this form if the Hamiltonian is of the form

H=T(t,v)+V(t,x).

The differential equations are to be solved with the initial condition

x(t0)=x0,    v(t0)=v0.

The method

The semi-implicit Euler method produces an approximate discrete solution by iterating

\begin{align} vn+1&=vn+g(tn,xn)\Deltat\\[0.3em] xn+1&=xn+f(tn,vn+1)\Deltat \end{align}

where Δt is the time step and tn = t0 + nΔt is the time after n steps.

The difference with the standard Euler method is that the semi-implicit Euler method uses vn+1 in the equation for xn+1, while the Euler method uses vn.

Applying the method with negative time step to the computation of

(xn,vn)

from

(xn+1,vn+1)

and rearranging leads to the second variant of the semi-implicit Euler method

\begin{align} xn+1&=xn+f(tn,vn)\Deltat\\[0.3ex] vn+1&=vn+g(tn,xn+1)\Deltat \end{align}

which has similar properties.

The semi-implicit Euler is a first-order integrator, just as the standard Euler method. This means that it commits a global error of the order of Δt. However, the semi-implicit Euler method is a symplectic integrator, unlike the standard method. As a consequence, the semi-implicit Euler method almost conserves the energy (when the Hamiltonian is time-independent). Often, the energy increases steadily when the standard Euler method is applied, making it far less accurate.

Alternating between the two variants of the semi-implicit Euler method leads in one simplification to the Störmer-Verlet integration and in a slightly different simplification to the leapfrog integration, increasing both the order of the error and the order of preservation of energy.

The stability region of the semi-implicit method was presented by Niiranen[2] although the semi-implicit Euler was misleadingly called symmetric Euler in his paper. The semi-implicit method models the simulated system correctly if the complex roots of the characteristic equation are within the circle shown below. For real roots the stability region extends outside the circle for which the criterion is

s>-2/\Deltat

As can be seen, the semi-implicit method can simulate correctly both stable systems that have their roots in the left half plane and unstable systems that have their roots in the right half plane. This is clear advantage over forward (standard) Euler and backward Euler. Forward Euler tends to have less damping than the real system when the negative real parts of the roots get near the imaginary axis and backward Euler may show the system be stable even when the roots are in the right half plane.

Example

The motion of a spring satisfying Hooke's law is given by

\begin{align}

dx
dt

&=v(t)\\[0.2em]

dv
dt

&=-

k
m

x=-\omega2x. \end{align}

The semi-implicit Euler for this equation is

\begin{align} vn+1&=vn-

2x
\omega
n\Delta

t\\[0.2em] xn+1&=xn+vn+1\Deltat. \end{align}

Substituting

vn+1

in the second equation with the expression given by the first equation, the iteration can be expressed in the following matrix form

\begin{bmatrix}xn+1\\vn+1\end{bmatrix}=\begin{bmatrix}1-\omega2\Deltat2&\Deltat\ -\omega2\Deltat&1\end{bmatrix}\begin{bmatrix}xn\vn\end{bmatrix},

and since the determinant of the matrix is 1 the transformation is area-preserving.

The iteration preserves the modified energy functional

2+\omega
E
h(x,v)=\tfrac12\left(v

2x2-\omega2\Deltatvx\right)

exactly, leading to stable periodic orbits (for sufficiently small step size) that deviate by

O(\Deltat)

from the exact orbits. The exact circular frequency

\omega

increases in the numerical approximation by a factor of

1+\tfrac1{24}\omega2\Deltat2+O(\Deltat4)

.

References

  1. Cromer . Alan . 1981-05-01 . Stable solutions using the Euler approximation . American Journal of Physics . 49 . 5 . 455–459 . 10.1119/1.12478 . 0002-9505.
  2. https://www.researchgate.net/publication/268034494_Fast_and_accurate_symmetric_Euler_algorithm_for_electromechanical_simulations_NOTE_The_method_became_later_known_as_Symplectic_Euler Niiranen, Jouko: Fast and accurate symmetric Euler algorithm for electromechanical simulations

[3]