MATH36022 Error in Midpoint Rule 2017

MATH36022
Error in Midpoint Rule
2017
Recall the standard midpoint rule on [a, b] is
Z b
f (x) dx ≈ (b − a)f 1 ,
2
a
where f 1 = f ((a + b)/2). We can interpret this rule as the Newton-Cotes rule with n = 0
2
by noting that the polynomial p0 (x) of degree zero that interpolates f at x 1 := (a + b)/2 is
2
p0 (x) = f 1 . Replacing f by the constant p0 and integrating indeed gives
2
b
Z
Z
f 1 dx = (b − a)f 1 .
p0 (x)dx =
a
b
2
a
2
In the introduction we saw that the midpoint rule has degree of precision 1 (integrates
exactly all polynomials of degree one or less), just like the trapezium rule. To analyse the error,
we can’t use the approach we used for the trapezium rule (based on the Mean Value Theorem)
since in the expression for the interpolation error,
f (x) − p0 (x) = f 0 (ξx )(x − x 1 ),
2
the term multiplying the derivative changes sign on [x0 , x1 ]. Instead, we’ll write f (x) as a linear
Taylor series, with remainder. Write x0 = a and x1 = b, with h = (b − a), then
f (x) = f 1 + (x − x 1 )f 10 + (x − x 1 )2
2
2
2
2
f 00 (ξx )
,
2
for some ξx ∈ (x0 , x1 ).
Integrating, the error is,
Z
x1
x1
Z
f (x) dx −
x0
Z
x1
f 1 dx =
x0
2
Z
x1
(x − x 1 )2
2
f 00 (ξx ) dx
(x − x 1 )f 1 dx +
2
2
2
x0
x0
Z x1
00
f (η)
(by M.V.T. for integrals)
=0+
(x − x 1 )2 dx
2
2
x0
h3
= f 00 (η),
for some η ∈ [x0 , x1 ].
24
0
Repeated midpoint rule
Just like for the trapezium rule rule we can divide [a, b] into n equal subintervals of length
h and apply the midpoint rule on each subinterval, to obtain the repeated midpoint rule
Z
b
f (x) dx =
a
n−1 Z
X
i=0
xi+1
xi
f (x) dx ≈
n−1
X
hfi+ 1 ≡ M (h),
2
i=0
(equivalent to approximating f (x) by a piecewise constant polynomial). With a similar derivation as for the repeated trapezium rule error we can obtain
MATH36022: Error in Midpoint Rule
Page 2
h2 (b − a) 00
ERM (f ) =
f (θ),
24
θ ∈ [a, b ].
Comparison to repeated trapezium rule
We have just seen that the error for the repeated midpoint rule is
ERM (f ) =
h2 (b − a) 00
f (θ),
24
for some θ ∈ [a, b ],
and in lectures we showed that the error for the repeated trapezium rule is
ERT (f ) =
−h2 (b − a) 00
f (θ),
12
for some θ ∈ [a, b ],
(θ 6= θ in general). If f 00 is fairly constant on [a, b] then we’d expect M (h) to be about twice as
accurate as T (h), which is perhaps surprising given that the midpoint rule is based on a lower
degree interpolating polynomial than the trapezium rule. We can use this observation to derive
an “improved” approximation.
Extrapolation
Assume f 00 is roughly constant on [a, b] so that (b − a)f 00 (x) ≈ k = constant. Then
ERM (f ) = I(f ) − M (h) = kh2 /24,
ERT (f ) = I(f ) − T (h) = −kh2 /12.
(1)
(2)
Now, a linear combination of the errors is zero since
2 × (1) + (2)
⇒
3I(f ) − 2M (h) − T (h) = 0.
In other words, an improved approximation is given by
1
I(f ) ≈ (2M (h) + T (h)).
3
What is this new rule? With n = 1,
h
f0 + f1
h
I(f ) ≈
2f 1 +
= f0 + 4f 1 + f1
2
2
3
2
6
= Simpson’s rule.
This formula can also be derived as an interpolatory rule, based on the quadratic polynomial
p2 (x) passing through x0 = a, x 1 , x1 = b. (Check!)
2
This technique of “eliminating the error” is exploited more systematically in the Romberg
Scheme (see lectures).