4.6 Numerical Integration 305
4.6 Numerical Integration
Approximate a definite integral using the Trapezoidal Rule. Approximate a definite integral using Simpson’s Rule. Analyze the approximate errors in the Trapezoidal Rule and Simpson’s Rule.
The Trapezoidal Rule y Some elementary functions simply do not have antiderivatives that are elementary functions. For example, there is no elementary function that has any of the following functions as its derivative. cos x Ί3 xΊ1 x, Ίx cos x, , Ί1 x3, sin x2 x If you need to evaluate a definite integral involving a function whose antiderivative f cannot be found, then while the Fundamental Theorem of Calculus is still true, it cannot be easily applied. In this case, it is easier to resort to an approximation technique. Two such techniques are described in this section. x x = axx x x = b One way to approximate a definite integral is to use n trapezoids, as shown in 0 1 2 3 4 Figure 4.42. In the development of this method, assume that f is continuous and The area of the region can be positive on the interval ͓a, b͔. So, the definite integral approximated using four trapezoids. b Figure 4.42 ͵ ͑ ͒ f x dx a represents the area of the region bounded by the graph of f and the x- axis, from x a to x b. First, partition the interval ͓a, b͔ into n subintervals, each of width x ͑b a͒͞n, such that . . . a x0 < x1 < x2 < < xn b. y Then form a trapezoid for each subinterval (see Figure 4.43). The area of the i th trapezoid is
f ͑x ͒ f ͑x ͒ b a Area of i th trapezoid ΄ i 1 i ΅ . 2 n This implies that the sum of the areas of the n trapezoids is f(x0) b a f ͑x ͒ f ͑x ͒ f ͑x ͒ f ͑x ͒ Area ΄ 0 1 . . . n 1 n ΅ f(x1) n 2 2 x b a . . . x x ͓ f ͑x ͒ f ͑x ͒ f ͑x ͒ f ͑x ͒ f ͑x ͒ f ͑x ͔͒ 0 1 2n 0 1 1 2 n 1 n b − a n b a ͓ f ͑x ͒ 2 f ͑x ͒ 2 f ͑x ͒ . . . 2 f ͑x ͒ f ͑x ͔͒. 2n 0 1 2 n 1 n The area of the first trapezoid is f ͑x ͒ f ͑x ͒ b a Letting x ͑b a͒͞n, you can take the limit as n → to obtain ΄ 0 1 ΅ . 2 n b a ͓ ͑ ͒ ͑ ͒ . . . ͑ ͒ ͑ ͔͒ Figure 4.43 lim f x0 2f x1 2f xn 1 f xn n→ 2n ͓ f͑a͒ f ͑b͔͒ x n lim ΄ f ͑xi͒ x΅ → ͚ n 2 i 1 ͓ f ͑a͒ f͑b͔͒͑b a͒ n lim lim f͑x ͒ x → → ͚ i n 2n n i 1 b 0 ͵ f ͑x͒ dx. a The result is summarized in the next theorem.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. 306 Chapter 4 Integration
THEOREM 4.17 The Trapezoidal Rule Let f be continuous on ͓a, b͔. The Trapezoidal Rule for approximating ͐b ͑ ͒ a f x dx is b ͵ ͑ ͒ Ϸ b a ͓ ͑ ͒ ͑ ͒ ͑ ͒ . . . ͑ ͒ ͑ ͔͒ f x dx f x0 2 f x1 2 f x2 2 f xn 1 f xn . a 2n → ͐b ͑ ͒ Moreover, as n , the right-hand side approaches a f x dx.
REMARK Observe that the coefficients in the Trapezoidal Rule have the following pattern. 1222. . .221
Approximation with the Trapezoidal Rule
y Use the Trapezoidal Rule to approximate y = sin x ͵ sin x dx. 1 0 Compare the results for n 4 and n 8, as shown in Figure 4.44. ͞ x Solution When n 4, x 4, and you obtain πππ π 3 3 4 24 ͵ sin x dx Ϸ sin 0 2 sin 2 sin 2 sin sin 8 4 2 4 Four subintervals 0 ͑0 Ί2 2 Ί2 0͒ y 8 ͑1 Ί2͒ y = sin x 4 1 Ϸ 1.896. When n 8, x ͞8, and you obtain x 3 π π 3π π 5π 3π 7π π ͵ sin x dx Ϸ sin 0 2 sin 2 sin 2 sin 2 sin 8 4 8 2 8 4 8 0 16 8 4 8 2 5 3 7 Eight subintervals 2 sin 2 sin 2 sin sin Trapezoidal approximations 8 4 8 Figure 4.44 3 2 2Ί2 4 sin 4 sin 16 8 8 Ϸ 1.974. For this particular integral, you could have found an antiderivative and determined that the exact area of the region is 2.
TECHNOLOGY Most graphing utilities and computer algebra systems have built-in programs that can be used to approximate the value of a definite integral. Try using such a program to approximate the integral in Example 1. How close is your approximation? When you use such a program, you need to be aware of its limitations. Often, you are given no indication of the degree of accuracy of the approximation. Other times, you may be given an approximation that is completely wrong. For instance, try using a built-in numerical integration program to evaluate 2 1 ͵ dx. 1 x Your calculator should give an error message. Does yours?
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. 4.6 Numerical Integration 307
It is interesting to compare the Trapezoidal Rule with the Midpoint Rule given in Section 4.2. For the Trapezoidal Rule, you average the function values at the endpoints of the subintervals, but for the Midpoint Rule, you take the function values of the subinterval midpoints. b n xi xi 1 ͵ f ͑x͒ dx Ϸ ͚ f x Midpoint Rule a i 1 2 b n ͑ ͒ ͑ ͒ f xi f xi 1 ͵ ͑ ͒ Ϸ Trapezoidal Rule f x dx ͚ x a i 1 2 There are two important points that should be made concerning the Trapezoidal Rule (or the Midpoint Rule). First, the approximation tends to become more accurate as n increases. For instance, in Example 1, when n 16, the Trapezoidal Rule yields an approximation of 1.994. Second, although you could have used the Fundamental Theorem to evaluate the integral in Example 1, this theorem cannot be used to evaluate ͐ 2 2 an integral as simple as 0 sin x dx because sin x has no elementary antiderivative. Yet, the Trapezoidal Rule can be applied to estimate this integral.
Simpson’s Rule One way to view the trapezoidal approximation of a definite integral is to say that on each subinterval, you approximate f by a first-degree polynomial. In Simpson’s Rule, named after the English mathematician Thomas Simpson (1710–1761), you take this procedure one step further and approximate f by second-degree polynomials. Before presenting Simpson’s Rule, consider the next theorem for evaluating integrals of polynomials of degree 2 (or less).
Ax 2 ؉ Bx ؉ C ؍ THEOREM 4.18 Integral of p ͧxͨ If p͑x͒ Ax2 Bx C, then b b a a b ͵ p͑x͒ dx ΄p͑a͒ 4p p͑b͒΅. a 6 2
Proof b b ͵ p͑x͒ dx ͵ ͑Ax2 Bx C͒ dx a a Ax3 Bx2 b ΄ Cx΅ 3 2 a A͑b3 a3͒ B͑b2 a2͒ C͑b a͒ 3 2 b a ͓2A͑a2 ab b2͒ 3B͑b a͒ 6C͔ 6 By expansion and collection of terms, the expression inside the brackets becomes b a 2 b a ͑Aa2 Ba C͒ 4΄A B C΅ ͑Ab2 Bb C͒ 2 2
a b p͑a͒ 4p p͑b͒ 2 and you can write b b a a b ͵ p͑x͒ dx ΄p͑a͒ 4p p͑b͒΅. a 6 2 See LarsonCalculus.com for Bruce Edwards’s video of this proof.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. 308 Chapter 4 Integration
y To develop Simpson’s Rule for approximating a definite integral, you again partition the interval ͓a, b͔ into n subintervals, each of width x ͑b a͒͞n. This (x , y ) 2 2 time, however,n is required to be even, and the subintervals are grouped in pairs such that p f . . . a x0 < x1 < x2 < x3 < x4 < < xn 2 < xn 1 < xn b. (x1, y1) ͓ ͔ ͓ ͔ ͓ ͔ x0, x2 x2, x4 xn 2, xn ͓ ͔ On each (double) subinterval xi 2, xi , you can approximate f by a polynomial p of (x0, y0) degree less than or equal to 2. (See Exercise 47.) For example, on the subinterval ͓ ͔ ͑ ͒ x0, x2 , choose the polynomial of least degree passing through the points x0, y0 , ͑ ͒ ͑ ͒ x x1, y1 , and x2, y2 , as shown in Figure 4.45. Now, using p as an approximation of f on x x x x 0 1 2 n this subinterval, you have, by Theorem 4.18,
x2 x2
x2 x2 ͵ f ͑x͒ dx Ϸ ͵ p͑x͒ dx ͵ ͑ ͒ Ϸ ͵ ͑ ͒ x x p x dx f x dx 0 0 x x 0 0 x x x x 2 0 ΄p͑x ͒ 4p 0 2 p͑x ͒΅ Figure 4.45 6 0 2 2 2͓͑b a͒͞n͔ ͓ p͑x ͒ 4p ͑x ͒ p͑x ͔͒ 6 0 1 2 b a ͓ f ͑x ͒ 4 f ͑x ͒ f ͑x ͔͒. 3n 0 1 2 Repeating this procedure on the entire interval ͓a, b͔ produces the next theorem.
THEOREM 4.19 Simpson’s Rule REMARK Observe that the Let f be continuous on ͓a, b͔ and let n be an even integer. Simpson’s Rule for ͐b ͑ ͒ coefficients in Simpson’s Rule approximating a f x dx is have the following pattern. b ͵ ͑ ͒ Ϸ b a ͓ ͑ ͒ ͑ ͒ ͑ ͒ ͑ ͒ . . . f x dx f x0 4 f x1 2 f x2 4 f x3 142424. . .4241 a 3n