Content deleted Content added
Added a comma to help the introduction flow better |
m clean up spacing around commas and other punctuation fixes, replaced: ,D → , D, ,k → , k (2), ,y → , y (5) |
||
(10 intermediate revisions by 8 users not shown) | |||
Line 1:
{{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),
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),
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.
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>.
Line 22 ⟶ 23:
[[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
:<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))
which is obtained from the slope formula
{{NumBlk|:|<math> y'(t) \approx \frac{y(t+h) - y(t)}{h}
and keeping in mind that <math> y' = f(t, y).</math>
Line 34 ⟶ 35:
:<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).
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>:
Line 68 ⟶ 69:
* {{cite book
|author1=Griffiths, D. V. |author2=Smith, I. M. |title=Numerical methods for engineers: a programming approach
|publisher=CRC Press
|___location=Boca Raton
Line 78 ⟶ 79:
}}
* {{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}}
|