Semi-implicit Euler method: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Altered date. Added class. | Use this bot. Report bugs. | Suggested by Abductive | Category:Numerical differential equations | #UCB_Category 16/167
 
(43 intermediate revisions by 31 users not shown)
Line 1:
{{Short description|Modification of the Euler method for solving Hamilton's equations}}
In mathematics, the '''semi-implicit Euler method''' method, also called '''symplectic Euler''', '''semi-explicit Euler''', '''Euler–Cromer''', and '''Newton–Størmer–Verlet (NSV)''', is a modification of the [[Euler integration|Euler method]] for solving [[Hamilton's equations]], a system of [[ordinary differential equation]]s that arises in [[classical mechanics]]. It is a [[symplectic integrator]] and hence it yields better results than the standard Euler method.
 
== Origin ==
The method has been discovered and forgotten many times, dating back to Newton's ''Principiae'',<ref name="hairer2003" /> as recalled by Richard Feynman in his ''Feynman Lectures'' (Vol. 1, Sec. 9.6)<ref name="feynman1963" /> In modern times, the method was rediscovered in a 1956 preprint by René De Vogelaere that, although never formally published, influenced subsequent work on higher-order symplectic methods.<ref name="skeel2003" />
 
== Setting ==
 
The semi-implicit Euler method can be applied to a pair of [[differential equation]]s of the form{{citation needed|date=September 2019}}
:<math>\begin{align}
 
:<math> {dx \over dt} &= f(t,v) </math>\\
{dv \over dt} &= g(t,x),
 
:<math> {dv \over dtend{align} = g(t,x), </math>
 
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
Line 20 ⟶ 24:
 
The semi-implicit Euler method produces an approximate [[Discrete mathematics|discrete]] solution by iterating
:<math>\begin{align}
v_{n+1} &= v_n + g(t_n, x_n) \, \Delta t\\[0.3em]
x_{n+1} &= x_n + f(t_n, v_{n+1}) \, \Delta t
\end{align}</math>
 
where Δ''t'' is the time step and ''t<sub>n</sub>'' = ''t''<sub>0</sub> + ''n''Δ''t'' is the time after ''n'' steps.
:<math> v_{n+1} = v_n + g(t_n, x_n) \, \Delta t \quad</math>
 
The difference with the standard Euler method is that the semi-implicit Euler method uses ''v''<sub>''n''+1</sub> in the equation for ''x''<sub>''n''+1</sub>, while the Euler method uses ''v<sub>n</sub>''.
:<math> x_{n+1} = x_n + f(t_n, v_{n+1}) \, \Delta t \quad</math>
 
Applying the method with negative time step to the computation of <math>(x_n, v_n)</math> from <math>(x_{n+1}, v_{n+1})</math> and rearranging leads to the second variant of the semi-implicit Euler method
where <math> \Delta t </math> is the time step and <math>t_n = t_0 + n\,\Delta t</math> is the time after ''n'' steps.
:<math>\begin{align}
x_{n+1} &= x_n + f(t_n, v_n) \, \Delta t\\[0.3ex]
v_{n+1} &= v_n + g(t_n, x_{n+1}) \, \Delta t
\end{align}</math>
which has similar properties.
 
The semi-implicit Euler is a [[Numerical ordinary differential equations#Consistency and order|first-order integrator]], just as the standard Euler method. This means that it commits a global error of the order of &Delta;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 drift|energy increases steadily]] when the standard Euler method is applied, making it far less accurate.
The difference with the standard Euler method is that the semi-implicit Euler method uses <math>v_{n+1}</math> in the equation for <math>x_{n+1}</math>, while the Euler method uses <math>v_n</math>.
 
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.<ref name="hairer2003" />
The semi-implicit Euler is a [[Numerical ordinary differential equations#Consistency and order|first-order integrator]], just as the standard Euler method. This means that it commits a global error of the order of &Delta;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.
 
The stability region of the semi-implicit method was presented by Niiranen<ref>[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] Proceedings of the Electrimacs'99, Sept. 14-16, 1999 Lisboa, Portugal, Vol. 1, pages 71 - 78.</ref> 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 <math>s > - 2/\Delta t</math>
 
[[Image:Symplectic Euler stability region.jpeg]]
 
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 ==
Line 35 ⟶ 54:
The motion of a [[spring (device)|spring]] satisfying [[Hooke's law]] is given by
 
:<math> {dx \over dtbegin{align} = v(t) </math>
\frac{dx}{dt} &= v(t)\\[0.2em]
 
:<math> {dv \over frac{dv}{dt} &= -\frac{k \over }{m}\,x. =-\quad</math>omega^2\,x.
\end{align}</math>
 
The semi-implicit Euler for this equation is
 
:<math>\begin{align}
:<math>v_{n+1} = v_n - {k \over m}x_n\,\Delta t \quad</math>
v_{n+1} &= v_n - \omega^2\,x_n\,\Delta t \\[0.2em]
x_{n+1} &= x_n + v_{n+1} \,\Delta t.
\end{align}</math>
 
Substituting <math>v_{n+1}</math> in the second equation with the expression given by the first equation, the iteration can be expressed in the following matrix form
:<math>x_{n+1} = x_n + v_{n+1} \,\Delta t. \quad</math>
:<math>\begin{bmatrix} x_{n+1} \\v_{n+1}\end{bmatrix} =
\begin{bmatrix}
1-\omega^2 \Delta t^2 & \Delta t \\
-\omega^2 \Delta t & 1
\end{bmatrix} \begin{bmatrix} x_{n} \\ v_{n} \end{bmatrix},</math>
and since the [[determinant]] of the matrix is 1 the transformation is area-preserving.
 
The iteration preserves the modified energy functional <math>E_h(x,v)=\tfrac12\left(v^2+\omega^2\,x^2-\omega^2\Delta t\,vx\right)</math> exactly, leading to stable periodic orbits (for sufficiently small step size) that deviate by <math>O(\Delta t)</math> from the exact orbits. The exact circular frequency <math>\omega</math> increases in the numerical approximation by a factor of <math>1+\tfrac1{24}\omega^2\Delta t^2+O(\Delta t^4)</math>.
 
== References ==
<references>
<ref name="hairer2003">{{cite journal
| first1=Ernst | last1=Hairer
| first2=Christian | last2=Lubich
| first3=Gerhard | last3=Wanner
| title=Geometric numerical integration illustrated by the Störmer/Verlet method
| journal = Acta Numerica
| year = 2003
| volume = 12
| pages = 399–450
| doi=10.1017/S0962492902000144
| bibcode=2003AcNum..12..399H
| citeseerx=10.1.1.7.7106
| s2cid=122016794
}}</ref>
 
<ref name="skeel2003">{{cite arXiv
* {{cite book |last= Giordano
| last1 = Skeel
|first= Nicholas J.
| first1 = Robert D.
|coauthors= Hisao Nakanishi
| last2 = Cieśliński
|title= Computational Physics
| first2 = Jan L.
|edition= 2nd edition
| date = 2020
|publisher= Benjamin Cummings
| title = On the famous unpublished preprint "Methods of integration which preserve the contact transformation property of the Hamilton equations" by René De Vogelaere
|year= 2005
| class = math.NA
|month= July
| eprint = 2003.12268
|isbn= 0-1314-6990-8 }}
}}</ref>
* {{cite web
| last = MacDonald
| first = James
| title = The Euler-Cromer method
| publisher = [[University of Delaware]]
| url = http://www.physics.udel.edu/~jim/Ordinary%20Differential%20Equations/Euler-Cromer%20Method.htm
| accessdate = 2007-03-03}}
* {{cite book |last= Vesely
|first= Franz J.
|title= Computational Physics: An Introduction
|edition= 2nd edition
|publisher= Springer
|year= 2001
|isbn= 978-0-306-46631-1
|pages=page 117}}
 
<ref name="feynman1963">{{cite book
| last = Feynman
| first = Richard P
| author-link =
| date = 1963
| title = ''The Feynman Lectures on Physics'', Vol. 1, Sec. 9.6
| url = https://www.feynmanlectures.caltech.edu/I_09.html
}}</ref>
 
</references>
 
* {{cite web|last=Nikolic|first=Branislav K.|title=Euler-Cromer method|publisher=[[University of Delaware]] | url=http://www.physics.udel.edu/~bnikolic/teaching/phys660/numerical_ode/node2.html|accessdate=2021-09-29}}
* {{cite book |last= Vesely|first= Franz J.|title= Computational Physics: An Introduction|url= https://archive.org/details/computationalphy00vese_143|url-access= limited|edition= 2nd|publisher= Springer|year= 2001|isbn= 978-0-306-46631-1|pages=[https://archive.org/details/computationalphy00vese_143/page/n125 117]}}
* {{cite book |last= Giordano|first= Nicholas J.|author2=Hisao Nakanishi|title= Computational Physics|edition= 2nd|publisher= Benjamin Cummings|date=July 2005|isbn= 0-13-146990-8 }}
 
{{Numerical integrators}}
 
[[Category:Numerical differential equations]]