




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





This lesson, meant as a supplement to Chapter 8 in the Text, discusses numerical integration.
1 Introduction
The integral
I(f ) =
∫ (^) b
a
f (x) dx
is, in most practical cases, impossible to evaluate analytically. Even for simple functions such as f (x) = sin x^2 , the integral does not exist in terms of other elementary functions. Numerical approximation is therefore the only option.
Integrals are numerically approximated by quadrature rules, which are finite sums of the form
Qn(f ) =
∑^ n
i=
wi f (xi).
This is an n -point rule, where the points xi are sampling points, or nodes, obeying
a ≤ x 1 < x 2 <... < xn− 1 < xn ≤ b,
and the wi are weights. The main issues are: how to choose the nodes, and how to determine the weights so that an accurate approximation is obtained at low cost (i.e., with as few function evaluations as possible.)
A quadrature rule can be thought of as a generalized Riemann sum, inspired by the form
Sn =
∑^ n
i=
f (xi) ∆xi,
with the wi replacing the ∆xi. However, unlike the Riemann sum, the weights in a quadrature rule need not be all positive.
The weights depend upon a, b and the nodes, but not on the function f.
The rule is closed if a = x 1 and b = xn; otherwise it is open.
When the nodes are equispaced, the rule is said to belong to the Newton-Cotes class.
A quadrature rule can be derived by approximating f by its polynomial interpolant F on the nodes xi, and then replacing f in the integrand by F. Thus,
I(f ) ≈ I(F )
=
∫ (^) b
a
F (x) dx
= Qn(f ).
If Lagrange interpolation is used, then
F (x) =
∑^ n
i=
f (xi)Li(x),
whence
Qn(f ) =
∫ (^) b
a
∑n
i=
f (xi)Li(x) dx
∑^ n
i=
f (xi)
∫ (^) b
a
Li(x) dx
We can also make use of the Taylor theorem for error evaluation. Consider Simpson’s rule:
∫ (^) b
a
f (x) dx = b − a 6
[f (a) + 4f (a + h) + f (a + 2h)] + ES ,
where now, h = (b − a)/ 2. Upon expanding each side in a Taylor expansion about a and cancelling common terms (fill in details), one obtains
h^5 90 f (4)(a) + · · · = −
h^5 90 f (4)(η).
Note that the error for the two-point trapezoidal rule is proportional to h^3 f ′′^ while that for the 3-point Simpson’s rule is proportional to h^5 f (4). In can be shown that in general, the error for n even is Kf (n)hn+ while that for n odd is Kf (n+1)hn+2.
A related notion is that of the degree of precision d of a quadrature rule: it is the highest-degree polynomial for which the rule is exact. The above discussion suggests that the precision of Qn is n for n odd and n − 1 for n even. The constant of proportionality K in the error formulas can then be evaluated easily by applying the rule to the first monomial for which it is not exact. For example, consider the 3-point Simpson’s rule: (^) ∫ 2 h
0
f (x) dx =
h 3
[f (0) + 4f (h) + f (2h)] + Kh^5 f (4)(η).
Applying the rule to f = x^4 , for which f (4)^ = 24, we get
(2h)^5 5
h 3 [4h^4 + (2h)^4 ] + 24Kh^5 ,
whence
K = −
as above.
Remarks
|I(f ) − I( fˆ )| =
∫ (^) b
a
(f − fˆ ) dx
∫ (^) b
a
|f − fˆ | dx
≤ (b − a)||f − fˆ ||∞,
so that the absolute condition number of the integration problem, i.e., the ratio of the output error to the input error, is simply b − a. For the quadrature rule,
|Qn(f ) − Qn( fˆ )| = |Qn(f − fˆ )|
=
∑^ n
i=
wi
f (xi) − fˆ (xi)
∑^ n
i=
|wi| |f (xi) − fˆ (xi)|
( (^) ∑n
i=
|wi|
||f − fˆ ||∞.
Thus the absolute condition number of the numerical rule is
∑n i=1 |wi|.^ Recall the first moment equation of the derivation of an interpolatory quadrature rule:
∑n i=1 wi^ =^ b^ −^ a.^ If all weights are positive, the numerical and analytical integration problems have the same condition number, so that the quadrature rule is stable. If some of the weights are negative, as is true for n ≥ 11 , then the numerical condition number can be much larger. In fact, it can be shown that
∑n i=1 |wi| → ∞^ as n → ∞, so that the Newton-Cotes rules become arbitrarily ill-conditioned as n grows. The presence of large positive and negative weights also leads to the integral being computed as the sum of large quantities of differing signs, further leading to inaccuracies.
2 Gaussian Quadrature
In Gaussian quadrature, both the nodes and the weights are considered free parameters, to be derived for optimal accuracy. The derivation of the 2 n parameters is done by requiring that the rule be exact for monomials up to degree 2n − 1. The resulting system of equations is nonlinear. Example: n = 2 and n = 3.
The rules are typically open rules. Points are bunched closer near the ends of the interval.
Derivation of the nodes on [− 1 , 1] can also be accomplished by employing orthogonal polynomials, and it turns out, that the n nodes are the real zeros of the Legendre polynomial of degree n. Thus, the zeros of the Legendre polynomial P 2 = x^2 − 1 / 3 , ± 1 /
3 , are the nodes for the 2-point Gaussian rule, while those of the Legendre polynomial P 3 = x^3 − 3 x/ 5 , 0 , ±
3 / 5 , are those for the 3-point rule. The nodes can be ported to an arbitrary interval by the usual linear transformation. Usually, one transfers the original interval to [− 1 , 1] and transforms the integrand accordingly.
3 Composite Quadrature
An alternative to using Qn with a large n is to subdivide the original interval [a, b] into k subintervals or panels, and to use a lower-order quadrature rule on each panel. This is equivalent to a piecewise polynomial interpolation of the integrand. The composite rule is stable if the underlying low-order rule is. Thus, with panel width p = (b − a)/k and a rule of order n we have
I(f ) =
∫ (^) b
a
f (x) dx =
∑^ k
j=
∫ (^) a+jp
a+(j−1)p
f (x) dx ≈
∑^ k
j=
Qjn(f ),
where Qjn(f ) is the order n rule applied to panel j.
Example. Compound Trapezoidal rule: panel width p = h = (b − a)/k.
I(f ) =
∫ (^) b
a
f (x) dx = h 2
[{f (a) + f (a + h)} + {f (a + h) + f (a + 2h)} + · · · {f (a + [k − 1]h) + f (a + kh)}]
h 2
[f (a) + 2f (a + h) + · · · + 2f (a + [k − 1]h) + f (a + kh)].
The error is the sum over all panels, i.e.,
h^3 12 [f (2)(ξ 1 ) + f (2)(ξ 2 ) + · · · f (2)(ξk)] = −k
h^3 12 f (2)(ξ) = −(b − a)
h^2 12 f (2)(ξ).
This form of the error indicates that for a given interval of integration, the composite rule is of order 2, i.e., halving of the panel width reduces the error by a factor of 1/ 22.
Example. Evaluation of ∫ (^1)
√ x dx
to an accuracy of δ = 0.0005 by adaptive quadrature.
The notation used below is as follows.
S(a, b) = Result of Simpson’s rule, with h = b − a,
S^ ¯(a, b) = Result of composite Simpson’s rule, with h = (b − a)/ 2 ,
E(a, b) = Estimate of the error associated with S¯(a, b).
We begin by dividing the interval (0, 1) into two panels of equal width. On
each, the acceptable tolerance is δ/2 = 0. 00025.
S(1/ 2 , 1) = 0. 43093403
S¯(1/ 2 , 1) = 0. 43096219
E(1/ 2 , 1) =
1
15
( S¯ − S) = 0. 0000018775 <
1
2
(0.0005) = 0. 00025.
Since tolerance is satisfied, accept S¯(1/ 2 , 1).
S(0, 1 /2) = 0. 22559223
S¯(0, 1 /2) = 0. 23211709
E(0, 1 /2) = 0. 00043499 > 0. 00025.
Unacceptable. Divide subinterval and repeat. Error per new subinterval = 0.00025/2 = 0.000125.
S(1/ 4 , 1 /2) = 0. 15235819
S¯(1/ 4 , 1 /2) = 0. 15236814
E(1/ 4 , 1 /2) = 0. 664 × 10
< 0. 000125.
Since tolerance is satisfied, accept S¯(1/ 4 , 1 /2).
S(0, 1 /4) = 0. 07975890
S¯(0, 1 /4) = 0. 08206578
E(0, 1 /4) = 0. 00015 > 0. 000125.
Unacceptable. Divide subinterval and repeat. Error per subinterval =
000125 /2 = 0. 625 × 10 −^4.
S(1/ 8 , 1 /4) = 0. 05386675
S¯(1/ 8 , 1 /4) = 0. 05387027
E(1/ 8 , 1 /4) = 0. 2346 × 10
< 0. 625 × 10
.
Since tolerance is satisfied, accept S¯(1/ 8 , 1 /4).
S(0, 1 /8) = 0. 02819903
S¯(0, 1 /8) = 0. 02901464
E(0, 1 /8) = 0. 5437 × 10
< 0. 625 × 10
.
Since tolerance is satisfied, accept S¯(0, 1 /8).
Result:
I = S¯(0, 1 /8) + S¯(1/ 8 , 1 /4) + S¯(1/ 4 , 1 /2) + S¯(1/ 2 , 1) = 0. 66621524.
Iexact = 2/3 = 0. 66666667.
E = 0. 00045143 < 0. 0005.