Midpoint method: Difference between revisions

Content deleted Content added
Queeten (talk | contribs)
No edit summary
Queeten (talk | contribs)
No edit summary
Line 12:
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 midpointcurve (that is awhat pointis "into thebe future"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>.