Solution of Nonlinear Equations F (X) 0: Professor Henry Arguello
Solution of Nonlinear Equations F (X) 0: Professor Henry Arguello
1 Introduction to Quadrature
4 Gauss-Legendre Integration
Definition 7.1
Suppose that a = x0 < x1 < · · · < xM = b. A formula of the form.
M
X
Q[f ] = wk f (xk ) = w0 f (x0 ) + wq f (x1 ) + · · · + wM f (xM ) (1)
k=0
Definition 7.2
The degree of precision of a quadrature formula is the positive
integer n such that E[Pi ] = 0 for all polynomials Pi (x) of degree i ≤ n,
but for which E[Pn+1 ] 6= 0 for some polynomial Pn+1 (x) of degree n + 1.
The form of E[Pi ] can be anticipated by studying what happens when
f (x) is a polynomial. Consider the arbitrary polynomial
Pi (x) = ai xi + ai−1 xi−1 + · · · + a1 x + a0
(n+1) (n+1)
of degree i. If i ≤ n, then Pi (x) ≡ 0 for all x, and Pn+1 (x) = (n + 1)!
an−1 for all x. Thus it is not surprising that the general form for the
truncation error term is
E[ f ] = Kf (n+1) (c), (3)
where K is a suitably chosen constant and n is the degree of precision.
1.5 1.5
y=f(x) y=f(x)
1.0 1.0
0.5 0.5
x x
0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0
: :
y y
1.5 1.5
y=f(x) y=f(x)
1.0 1.0
0.5 0.5
x x
0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0
: :
M Z
X xM M
X
= LM,k (x) dx fk = wk fk .
k=0 x0 k=0
Z x2 Z 2 Z 2
h(t − 1)h(t − 2) h(t − 0)h(t − 2)
f (x) dx ≈ f0 h dt + f1 h dt (16)
x0 0 (−h)(−2h) 0 (h)(−h)
Z 2
h(t − 0)h(t − 1)
+f2 h dt
0 (2h)(h)
Z 2 Z 2 Z 2
h h
= f0 (t2 − 3t + 2) dt − f1 h (t2 − 2t)dt + f2 (t2 − t) dt
2 0 0 2 0
t=2 t=2
t3 3t2
3
h t
= f0 − + 2t − f1 h − t2
2 3 2 t=0 3 t=0
2 t=2
3
h t t
+f2 −
2 3 2 t=0
h 2 −4 h 2
= f0 − f1 h + f2
2 3 3 2 3
h
= (f0 + 4f1 + f2 )
3
and the proof is complete.
Professor Henry Arguello Numerical methods March 19, 2014 14 / 81
Introduction to Quadrature
Example 7.1 Consider the function f (x) = 1 + e−x sin(4x), the equally
spaced quadrature nodes x0 = 0.0, x1 = 0.5, x2 = 1.0, x3 = 1.5, and
x4 = 2.0, and the corresponding function values
f0 = 1.00000, f1 = 1.55152, f2 = 0.72159, f3 = 0.93765, and f4 = 1.13390.
Apply the various quadrature formulas (4) through (7).
3
For Simpson’s 8 rule, h = 1/3, and we obtain
Z 1
3(1/3) 1 2
f (x) dx ≈ (f (0) + 3f ( ) + 3f ( ) + f (1))
0 8 3 3
1
= (1.00000 + 3(1.69642) + 3(1.23447) + 0.72159) = 1.31440
8
3
For Simpson’s 8 rule, h = 1/3, and we obtain
Z 1
3(1/3) 1 2
f (x) dx ≈ (f (0) + 3f ( ) + 3f ( ) + f (1))
0 8 3 3
1
= (1.00000 + 3(1.69642) + 3(1.23447) + 0.72159) = 1.31440
8
For Boole’s rule, h = 1/4, and the result is
Z 1
2(1/4) 1 1 3
f (x) dx ≈ (7f (0) + 32f ( ) + 12f ( ) + 32f ( ) + 7f (1))
0 45 4 2 4
1
= (7(1.00000) + 32(1.65534) + 12(1.55152)
90
+32(1.06666) + 7(0.72159)) = 1.30859.
and the approximation 1.30859 from Boole’s rule is best. The area
under each of the Lagrange polynomials P1 (x), P2 (x), P3 (x), and P4 (x)
is shown in Figure 7.3(a) through (d), respectively.
1.0 1.0
0.5 0.5
x x
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
y y
y=f(x) y=f(x)
1.5 1.5
1.0 1.0
0.5 0.5
x x
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
Figure 7.2: (a) The trapezoidal rule used over [0, 1] yields the approximation
0.86079. (b) Simpson’s rule used over [0, 1] yields the approximation 1.32128.
(c) Simpson’s 38 rule used over [0, 1] yields the approximation 1.31440. (d)
Boole’s rule used over [0, 1] yields the approximation 1.30859.
Simpson’s rule can also be used in this manner. When Simpson’s rule
is applied on the two subintervals [x0 , x2 ] and [x2 , x4 ], it is called a
composite Simpson’s rule:
Z x4 Z x2 Z x4
f (x) dx = f (x) dx + f (x) dx
x0 x0 x2
h h
≈ (f0 + 4f1 + f2 ) + (f2 + 4f3 + f4 ) (18)
3 3
h
= (f0 + 4f1 + 2f2 + 4f3 + f4 )..
3
The next example compares the values obtained with (17), (18), and
(7).
and the approximation 1.30938 from Simpson’s rule is much better than
the value 1.28358 obtained from the trapezoidal rule. Again, the
approximation 1.30859 from Boole’s rule is closest. Graphs for the
areas under the trapezoids and parabolas are shown in Figure 7.4(a)
and (b), respectively.
y y
1.0 1.0
0.5 0.5
t t
0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00
: :
Figure 7.4: (a) The composite trapezoidal rule yields the approximation
1.28358. (b) The composite Simpson rule yields the approximation 1.30938.
h
(1b) T(f , h) = (f0 + 2f1 + 2f2 + 2f3 + ... + 2fM−2 + 2fM−1 + fM )
2
M−1
h X
(1c) T(f , h) = (f (a) + f (b)) + h (f (xk ))
2
k=1
Professor Henry Arguello Numerical methods March 19, 2014 27 / 81
Composite Trapezoidal and Simpson’s Rule
Proof. Apply the trapezoidal rule over each subinterval [xk−1 , xk ]. Use
the additive property of integral for subintervals
Z b M Z xk M
X hX
(3) f (x)dx = f (x)dx ≈ (f (xk−1 ) + f (xk )
a xk−1 2
k=1 k=1
1 1
= (2.90929743 + 1.01735756) + (2.63815764 + 2.30807174 + 1.97931647
4 2
+1.68305284+1.43530410+1.24319750+1.10831775+1.02872220+1.00024140)
1 1
= (3.92665499) + (14.42438165) = 0.98166375 + 7.21219083 = 8.19385457
4 2
h
(4b) S(f , h) = (f0 + 4f1 + 2f2 + 4f3 + ... + 2fM−2 + 4fM−1 + fM )
3
M−1 M
h 2h X 4h X
(4c) S(f , h) = (f (a) + f (b)) + f (x2k ) + f (x2k−1 )
3 3 3
k=1 k=1
This is an approximation to the integral of f (x) over [a, b], and we write
Z b
(5) f (x)dx ≈ S(f , h)
a
Professor Henry Arguello Numerical methods March 19, 2014 30 / 81
Composite Trapezoidal and Simpson’s Rule
Proof. Apply Simpson’s rule over each subinterval [xk−1 , xk ]. Use the
additive property of the integral for subintervals:
Z b M Z 2xk M
X hX
(3) f (x)dx = f (x)dx ≈ (f (x2k−2 ) + 4f (x2k−1 + f (x2k ))
a x2k−2 3
k=1 k=1
2
= (2.63815764 + 1.97931647 + 1.43530410 + 1.10831775 + 1.00024140)
3
1 1 2
= (3.926654499) + (6.26304429) + (8.16133735)
6 3 3
Error Analysis
The significance of the next two results is to understand that the error
terms ET (f , h) and ES (f , h) for the composite trapezoidal rule and com-
posite Simpson rule are of the order O(h2 ) and O(h4 ), respectively. This
shows that the error for Simpson’s rule converges to zero faster than
the error for the trapezoidal rule as the step size h decreases to zero. In
cases where the derivatives of f (x) are known, the formulas
Furthermore, if f ∈ C2 [a, b], there exists a value c with a < c < b so that
the error term ET (f , h) has the form
−(b − a)f (2) (c)h2
(9) ET (f , h) = = O(h2 ).
12
Proof. We first determine the error term when the rule is applied over
[x0 , x1 ]. Integrating the Lagrange polynomial P1 (x) and its reminder
yields
x1 x1 x1
(x − x0 )(x − x1 )f (2) (c(x))
Z Z Z
(10) f (x)dx = P1 (x)dx + dx.
x0 x0 x0 21
The term (x−x0 )(x−x1 ) does not change sign on [x0 , x1 ], and f (2) (c(x)) is
continuous Hence the second mean value theorem for integrals implies
that there exist a value c1 so that
x1 x1
(x − x0 )(x − x1 )
Z Z
h
(11) f (x)dx = (f0 + f1 ) + f (2) (c1 ) dx.
x0 2 x0 2!
M M
X h h3 X (2)
= (f (xk−1 ) + f (xk )) − f (ck ).
2 12
k=1 k=1
Professor Henry Arguello Numerical methods March 19, 2014 36 / 81
Composite Trapezoidal and Simpson’s Rule
The first sum is the composite trapezoidal rule T(f , h). In the second
term, one factor of h replaced with its equivalent h = (b − a)/M, and
the result is
b M
(b − a)h2
Z
1 X (2)
f (x)dx = T(f , h) − f (ck )
a 12 M
k=1
Furthermore, if f ∈ C4 [a, b], there exists a value c with a < c < b so that
the error term ES (f , h) has the form
−(b − a)f (4) (c)h4
(16) ES (f , h) = = O(h4 ).
180
Table 7.2 shows the approximations T(f , h). The antiderivative of f (x) is
√
√ √
sin(2 x)
F(x) = 2x − xcos(2 x) + ,
2
and the true value of definite integral is
Z 6
f (x)dx = F(x)|x=6
x=1 = 8.1834792077.
1
Example7.9 Find the number M and the step size h so that the error
ET (f , h) for the Rcomposite trapezoidal rule is less than 5x10−9 for the
7
approximation 2 dx/x ≈ T(f , h). The integral is f (x) = 1/x and the
first two derivatives are f 0 (x) = −1/x2 and f (2) (x) = 2/x3 . The maximum
value of |f (2) (x)| taken over [2, 7] occurs at the endpoint x = 2, and those
we have the bound |f (2) (c)| ≤ |f (2) (2)| = 1/4, for 2 ≤ c ≤ 7. This is used
with formula (9) to obtain
Example7.10 Find the number M and the step size h so that the error
ES (f , h) for the −9
R 7 composite Simpson rule is less than 5x10 for (4) the ap-
proximation 2 dx/x ≈ S(f , h). The integral is f (x) = 1/x and f (x) =
24/x5 . The maximum value of |f (4) (x)| taken over [2, 7] occurs at the
endpoint x = 2, and those we have the bound |f (4) (c)| ≤ |f (4) (2)| = 3/4,
for 2 ≤ c ≤ 7. This is used with formula (16) to obtain
5
S f, = 1.252762973.
128
Proof. For the even nodes x0 < x2 < ... < x2M−2 < x2M , we use the
trapezoidal rule with step size 2h:
2h
(3) T(J − 1) = (f0 + 2f2 + 2f4 + ... + 2f2M−4 + 2f2M−2 + f2M )
2
For all the nodes x0 < x2 < ... < x2M−2 < x2M , we use the trapezoidal
rule with step size h
Professor Henry Arguello Numerical methods March 19, 2014 46 / 81
Recursive Rules and Romberg Integration
h
(4) T(J) = (f0 + 2f1 + 2f2 + ... + 2f2M−2 + 2f2M−1 + f2M ).
2
M
h X
(5) T(J) = (f0 + 2f1 + 2f2 + ... + 2f2M−2 + 2f2M−1 + f2M ) + h f2k−1 .
2
k=1
Example
T(1)
When h = 1 : T(2) = +1(0.500000+0.250000) = 0.933333+0.750000 = 1.68333
2
1 T(2) 1
When h = : T(3) = + (0.666667 + 0.400000 + 0.285714 + 0.222222)
2 2 2
= 0.841667 + 0.787302 = 1.628968.
The nine points used to computed T(3) and the midpoints required to
compute T(1), T(2) and T(3)
Endpoints for Midpoints for Midpoints for Midpoints for,
x f (x) = 1x computing T(0) computing T(1) computing T(2) computing T(3)
1.0 1.000000 1.000000
1.5 0.666667 0.666667
2.0 0.500000 0.500000
2.5 0.400000 0.400000
3.0 0.333333 0.333333
3.5 0.285714 0.285714
4.0 0.250000 0.250000
4.5 0.222222 0.222222
5.0 0.200000 0.200000
4T(J) − T(J − 1)
(7) S(J) = for J = 1, 2, ...
3
Professor Henry Arguello Numerical methods March 19, 2014 50 / 81
Recursive rules
Proof. The trapezoidal rule T(J) with step size h yields the
approximation
Z b
h
(8) f (x)dx ≈ (f0 +2f1 +2f2 +...+2f2M−2 +2f2M−1 +f2M ) = T(J).
a 2
The trapezoidal rule T(J − 1) with step size 2h produces
Z b
(9) f (x)dx ≈ h(f0 + 2f1 + 2f2 + ... + 2f2M−2 + f2M ) = T(J − 1).
a
Z b
(10) 4 f (x)dx ≈ h(2f0 +4f1 +4f2 +...+4f2M−2 +4f2M−1 +2f2M ) = 4T(J).
a
Z b
(11) 3 f (x)dx ≈ h(f0 + 4f1 + 2f2 + ... + 2f2M−2 + 4f2M−1 + f2M )
a
The pattern for the remainders in (15) through (17) is extended in the
following sense. Suppose that an approximation rule is used with step
sizes h and 2h; then an algebraic manipulation of the two answers is
used to produces an improved answer.
Professor Henry Arguello Numerical methods March 19, 2014 54 / 81
Romberg integration
(19) ET (f , h) = a1 h2 + a2 h4 + a3 h6 + ...
Since only even powers of h can occur in (19), the Richardson improvement
process is used successively first to eliminate a1 , next to eliminate a2 , then to
eliminate a3 , and so on. This process generates quadrature formulas whose
error terms have even orders O(h4 ), O(h6 ), O(h8 ), and so on. We shall show
that the first improvement is Simpson’s rule for 2M intervals. Start with T(f , 2h)
and T(f , h) and the equations
Z b
(20) f (x)dx = T(f , 2h) + a1 4h2 + a2 16h4 + a3 64h6 + ...
a
To show that the second improvement is Boole’s rule, start with (25)
and write down the formula involving S(f , 2h)
Z b
(26) f (x)dx = S(f , 2h) + b1 16h4 + b2 64h6 + b3 256h8 + ...
a
When b1 is eliminated from (25) and (26), the results involves Boole’s
rule
b
16S(f , h) − S(f , 2h) b2 48h6 b3 240h8
Z
(27) f (x)dx = − − − ...
a 15 15 15
b2 48h6 b3 240h8
= B(f , h) − − − ...
15 15
Professor Henry Arguello Numerical methods March 19, 2014 58 / 81
Romberg integration
And
Definition
Define the sequence {R(J, K) : J ≥ K}∞
J=0 of quadrature formulas for
f (x) over [a, b] as follows:
R(J, 0) = T(J) for J ≥ 0, is the sequential trapezoidal rule.
(31) R(J, 1) = S(J) for J ≥ 1, is the sequential Smpson rule.
R(J, 2) = B(J) for J ≥ 2, is the sequential Boole’s rule.
The starting rules {R(J, 0)} are used to generate the first improvement,
{R(J, 1)}, which in turn is to generate the second improvement,
{R(J, 2)}. We have already seen the patterns
41 R(J, 0) − R(J − 1, 0)
(32) R(J, 1) = for J ≥ 1.
41 − 1
42 R(J, 1) − R(J − 1, 1)
(32) R(J, 2) = for J ≥ 2.
42 − 1
The computation are given in Table 7.6. In each column the numbers
are converging to the value 2.038197427067... The values in the Simp-
son’s rule column converge faster than the values in the trapezoidal rule
column. For this example, convergence in columns to the right is faster
than the adjacent column to the left.
Z b
(34) f (x)dx = R(J, K) + bK h(2k+2) f 2k+2 (cJ,K ) = R(J, K) + O(h2k+2 )
a
The integral is f (x) = 10x9 , and f (10) (x) ≡ 0 . Thus the value K = 4
will make the error term identically zero. A numerical computation will
produce R(4, 4) = 1024.
Professor Henry Arguello Numerical methods March 19, 2014 64 / 81
Gauss-Legendre Integration
y y
y=f(x)
y=f(x)
x x
-1 0 1 -1 x1 0 x2 1
: :
Figure 7.10: (a) Trapezoidal approximation using the abscissas −1 and 1. (b)
Trapezoidal approximation using the abscissas x1 and x2 .
w1 + w2 = 2 (5)
w1 x1 = −w2 x2 (6)
2
w1 x12 + w2 x22 = (7)
3
w1 x13 = −w2 x23 (8)
Use (9) and divide (6) by x1 on the left and −x2 on the right to get
w1 = w2 . (10)
We have found the nodes and weights that make up the two-point
Gauss-Legendre rule. Since the formula is exact for cubic equations,
the error term will involve the fourth derivative.
where
f (4) (c)
E2 (f ) = . (15)
135
and compare the result with the trapezoidal rule T(f , h) with h = 2 and
Simpson’s rule S(f , h) with h = 1.
and compare the result with the trapezoidal rule T(f , h) with h = 2 and
Simpson’s rule S(f , h) with h = 1.
Let G2 (f ) denote the two-point Gauss-Legendre rule; then
G2 (f ) = f (−0.57735) + f (0.57735)
= 0.70291 + 0.38800 = 1.09091,
1
f (−1) + 4f (0) + f (1) 1+2+ 3
S(f , 1) = = = 1.11111.
3 3
The abscissas xN,k and weights wN,k to be used have been tabulated
and are easily available; Table 7.9 gives the value up to eight points.
Also include in the table is the form of the error term EN (f ) that
corresponds to GN (f ), and it can be used to determine the accuracy of
the Gauss-Legendre integration formula.
The nodes are actually roots of the Legendre polynomials, and the
corresponding weights must be obtained by solving a system of
equations. For the three-point Gauss-Legendre rule the nodes are
−(0.6)1/2 , 0, and (0.6)1/2 , and the corresponding weights are 5/9, 8/9,
and 5/9.
Truncation error
N Abscissas, xN,k Weights, wN,k EN (f )
±0.9061798459 0.2369268851
5 f (10) (c)
±0.5384693101 0.4786286705
1,237,732,650
0.0000000000 0.5688888888
Truncation error
N Abscissas, xN,k Weights, wN,k EN (f )
±0.9324695142 0.1713244924
6 f (12) (c)21 3(6!)4
±0.6612093865 0.3607615730
(12!)3 13!
±0.2386191861 0.4679139346
±0.9491079123 0.1294849662
±0.7415311856 0.2797053915 f (14) (c)21 5(7!)4
7
±0.4058451514 0.3818300505 (14!)3 15!
0.0000000000 0.4179591837
±0.9602898565 0.1012285363
±0.7966664774 0.2223810345 f (16) (c)21 7(8!)4
8
±0.5255324099 0.3137066459 (16!)3 17!
0.1834346425 0.3626837834
where
f (6) (c)
E3 (f ) = . (19)
15, 750
Since the integral is f (x) = 5x4 and f (6) (x) = 0, we can use (19) to see
that E3 (f ) = 0. But it is instructive to use (17) and do the calculations in
this case. 2 2
5(5)(0.6) + 0 + 5(5)(0.6) 18
G3 (f ) = = = 2.
9 9
The next result shows how to change the variable of integration so that
the Gauss-Legendre rules can be used on the interval [a, b].