Using MATLAB
The MATLAB function quad performs numerical quadrature using an adaptive
Simpson’s formula. The formula is adaptive because the subinterval width is
adjusted (reduced) while integrating to obtain a result within the specified absolute
tolerance (default: 1 × 10
−6
) during the integration. The syntax for the function is
I = quad(‘integrand_function’,a,b)
or
I = quad(‘integrand_function’, a, b, Tol)
where a and b are the limits of integration and Tol is the user-specified absolute
tolerance. The function handle supplied to the quad function must be able to accept
a vector input and deliver a vector output.
6.4 Richardson’s extrapolation and Romberg integration
The composite trapezoidal formula for equal subinterval widths is a low-order
approximation formula, since the leading order of the error term is Oh
2
. The
truncation error of the composite trapezoidal rule follows an infinite series consist-
ing of only even powers of h:
ð
b
a
fxðÞdx
h
2
fx
0
ðÞþ2
X
n1
i¼1
fx
i
ðÞþfx
n
ðÞ
"#
¼ c
1
h
2
þ c
2
h
4
þ c
3
h
6
þ;
(6:35)
the proof of which is not given here but is discussed in Ralston and Rabinowitz
(1978). Using Richardson’s extrapolation technique it is possible to combine the
numerical results of trapezoidal integration obtained for two different step sizes,
h
1
and h
2
, to obtain a numerical result, I
3
¼ fI
1
; I
2
ðÞ, that is much more accurate than
the two approximations I
1
and I
2
. The higher-order integral approximation
I
3
obtained by combining the two low-accuracy approximations of the trapezoidal
rule has an error whose leading order is Oh
4
. Thus, using the extrapolation
formula, we can reduce the error efficiently by two orders of magnitude in a singl e
step. The goal of the extrapolation method is to combine the two integral approxi-
mations in such a way as to eliminate the lowest-order error term in the error series
associated with the numerical result I
2
.
Suppose the trapezoidal rule is used to solve an integral over the interval ½a; b.
We get the numerical result Ih
1
ðÞfor subinterval width h
1
(n
1
subintervals), and the
result Ih
2
ðÞfor subinterval width h
2
(n
2
subintervals). If I
E
is the exact value of the
integral, and the error associated with the result Ih
1
ðÞis Eh
1
ðÞ, then
I
E
¼ Ih
1
ðÞþEh
1
ðÞ: (6:36)
Equation (6.23) defines the truncation error for the composite trapezoidal rule. We
have
Eh
1
ðÞ¼
ðb aÞh
2
1
f
00
12
:
If the error associated with the result Ih
2
ðÞis Eh
2
ðÞ, then
I
E
¼ Ih
2
ðÞþEh
2
ðÞ (6:37)
387
6.4 Richardson’s extrapolation and Romberg integration