Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Midpoint method
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Numeric solution for differential equations}} {{For|the midpoint rule in numerical [[Numerical integration|quadrature]]|rectangle method}} [[File:Midpoint method illustration.png|right|thumb|Illustration of the midpoint method assuming that <math>y_n</math> equals the exact value <math>y(t_n).</math> The midpoint method computes <math>y_{n+1}</math> so that the red chord is approximately parallel to the tangent line at the midpoint (the green line).]] In [[numerical analysis]], a branch of [[applied mathematics]], the '''midpoint method''' is a one-step method for [[Numerical ordinary differential equations|numerically]] solving the [[ordinary differential equation|differential equation]], :<math> y'(t) = f(t, y(t)), \quad y(t_0) = y_0 .</math> The explicit midpoint method is given by the formula {{NumBlk|:|<math> y_{n+1} = y_n + hf\left(t_n+\frac{h}{2},y_n+\frac{h}{2}f(t_n, y_n)\right), </math>|{{EquationRef|1e}}}} the implicit midpoint method by {{NumBlk|:|<math> y_{n+1} = y_n + hf\left(t_n+\frac{h}{2},\frac12 (y_n+y_{n+1})\right), </math>|{{EquationRef|1i}}}} for <math>n=0, 1, 2, \dots</math> Here, <math>h</math> is the ''step size'' — a small positive number, <math>t_n=t_0 + n h,</math> and <math>y_n</math> is the computed approximate value of <math>y(t_n).</math> The explicit midpoint method is sometimes also known as the '''modified Euler method''',<ref>{{harvnb|Süli|Mayers|2003|p=328}}</ref> the implicit method is the most simple [[collocation method]], and, applied to Hamiltonian dynamics, a [[symplectic integrator]]. Note that the '''modified Euler method''' can refer to [[Heun's method]],<ref>{{harvnb|Burden|Faires|2010|p=286}}</ref> for further clarity see [[List of Runge–Kutta methods]]. The name of the method comes from the fact that in the formula above, the function <math>f</math> giving the slope of the solution is evaluated at <math>t = t_n + h/2= \tfrac{t_n+t_{n+1}}{2},</math> the midpoint between <math>t_n</math> at which the value of <math>y(t)</math> is known and <math>t_{n+1}</math> at which the value of <math>y(t)</math> needs to be found. A geometric interpretation may give a better intuitive understanding of the method (see figure at right). In the basic [[Euler's method]], the tangent of the curve at <math>(t_n, y_n)</math> is computed using <math>f(t_n, y_n)</math>. The next value <math> y_{n+1}</math> is found where the tangent intersects the vertical line <math>t=t_{n+1}</math>. However, if the second derivative is only positive between <math>t_n</math> and <math>t_{n+1}</math>, or only negative (as in the diagram), the curve will increasingly veer away from the tangent, leading to larger errors as <math>h</math> increases. The diagram illustrates that the tangent at the midpoint (upper, green line segment) would most likely give a more accurate approximation of the curve in that interval. However, this midpoint tangent could not be accurately calculated because we do not know the curve (that is what is to be calculated). Instead, this tangent is estimated by using the original Euler's method to estimate the value of <math>y(t)</math> at the midpoint, then computing the slope of the tangent with <math>f()</math>. Finally, the improved tangent is used to calculate the value of <math>y_{n+1}</math> from <math>y_n</math>. This last step is represented by the red chord in the diagram. Note that the red chord is not exactly parallel to the green segment (the true tangent), due to the error in estimating the value of <math>y(t)</math> at the midpoint. The local error at each step of the midpoint method is of order <math>O\left(h^3\right)</math>, giving a global error of order <math>O\left(h^2\right)</math>. Thus, while more computationally intensive than Euler's method, the midpoint method's error generally decreases faster as <math>h \to 0</math>. The methods are examples of a class of higher-order methods known as [[Runge–Kutta methods]]. ==Derivation of the midpoint method== [[File:Numerical integration illustration, step=1.svg|right|thumb|Illustration of numerical integration for the equation <math>y'=y, y(0)=1.</math> Blue: the [[Euler method]], green: the midpoint method, red: the exact solution, <math>y=e^t.</math> The step size is <math>h=1.0.</math>]] [[File:Numerical integration illustration step=0.25.svg|right|thumb|The same illustration for <math>h=0.25.</math> It is seen that the midpoint method converges faster than the Euler method.]] The midpoint method is a refinement of the [[Euler method]] :<math> y_{n+1} = y_n + hf(t_n,y_n),\, </math> and is derived in a similar manner. The key to deriving Euler's method is the approximate equality {{NumBlk|:|<math> y(t+h) \approx y(t) + hf(t,y(t)) </math>|{{EquationRef|2}}}} which is obtained from the slope formula {{NumBlk|:|<math> y'(t) \approx \frac{y(t+h) - y(t)}{h} </math>|{{EquationRef|3}}}} and keeping in mind that <math> y' = f(t, y).</math> For the midpoint methods, one replaces (3) with the more accurate :<math> y'\left(t+\frac{h}{2}\right) \approx \frac{y(t+h) - y(t)}{h} </math> when instead of (2) we find {{NumBlk|:|<math> y(t+h) \approx y(t) + hf\left(t+\frac{h}{2},y\left(t+\frac{h}{2}\right)\right). </math>|{{EquationRef|4}}}} One cannot use this equation to find <math> y(t+h)</math> as one does not know <math>y</math> at <math>t+h/2</math>. The solution is then to use a [[Taylor series]] expansion exactly as if using the [[Euler method]] to solve for <math>y(t+h/2)</math>: :<math>y\left(t + \frac{h}{2}\right) \approx y(t) + \frac{h}{2}y'(t)=y(t) + \frac{h}{2}f(t, y(t)),</math> which, when plugged in (4), gives us :<math>y(t + h) \approx y(t) + hf\left(t + \frac{h}{2}, y(t) + \frac{h}{2}f(t, y(t))\right)</math> and the explicit midpoint method (1e). The implicit method (1i) is obtained by approximating the value at the half step <math>t+h/2</math> by the midpoint of the line segment from <math>y(t)</math> to <math>y(t+h)</math> :<math>y\left(t+\frac h2\right)\approx \frac12\bigl(y(t)+y(t+h)\bigr)</math> and thus :<math>\frac{y(t+h)-y(t)}{h}\approx y'\left(t+\frac h2\right)\approx k=f\left(t+\frac h2,\frac12\bigl(y(t)+y(t+h)\bigr)\right)</math> Inserting the approximation <math>y_n+h\,k</math> for <math>y(t_n+h)</math> results in the implicit Runge-Kutta method :<math>\begin{align} k&=f\left(t_n+\frac h2,y_n+\frac h2 k\right)\\ y_{n+1}&=y_n+h\,k \end{align}</math> which contains the implicit Euler method with step size <math>h/2</math> as its first part. Because of the time symmetry of the implicit method, all terms of even degree in <math>h</math> of the local error cancel, so that the local error is automatically of order <math>\mathcal O(h^3)</math>. Replacing the implicit with the explicit Euler method in the determination of <math>k</math> results again in the explicit midpoint method. ==See also== * [[Rectangle method]] * [[Heun's method]] * [[Leapfrog integration]] and [[Verlet integration]] ==Notes== {{reflist}} ==References== * {{cite book |author1=Griffiths, D. V. |author2=Smith, I. M. |title=Numerical methods for engineers: a programming approach |publisher=CRC Press |location=Boca Raton |year=1991 |isbn=0-8493-8610-1 |oclc= |doi= |page=218 }} * {{Citation | last1=Süli | first1=Endre | last2=Mayers | first2=David | title=An Introduction to Numerical Analysis | publisher=[[Cambridge University Press]] | isbn=0-521-00794-1 | year=2003}}. * {{cite book |last1=Burden | first1=Richard | last2=Faires | first2=John |title=Numerical Analysis |publisher=Richard Stratton|year=2010|isbn=978-0-538-73351-9|page=286}} {{Numerical integrators}} [[Category:Numerical differential equations]] [[Category:Runge–Kutta methods]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation
(
edit
)
Template:Cite book
(
edit
)
Template:For
(
edit
)
Template:Harvnb
(
edit
)
Template:NumBlk
(
edit
)
Template:Numerical integrators
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)