Numerical Methods of Integration For some functions it is impossibly to find a closed form (analytical) antiderivative. For these functions, we can approximate the area underneath them by using numerical methods. We’ve already done this using left-hand and right-hand Riemann Sums. These, however, give fairly bad approximations in general and require a large increase in the number of subintervals for a relatively small increase in accuracy. For example. The following elementary functions do not have antiderivatives which are elementary functions. √ √ 3 x 1−x √ x cos(x) cos(x) x √ 1 − x3 sin(x2 ) That is, the Fundamental Theorem of Calculus cannot be applied to these functions, so to evaluate a definite integral having on of these (or similar) functions as integrands we would need to use the approximation methods in this section. Objectives • Approximate a definite integral using the Midpoint Rule • Approximate a definite integral using the Trapezoidal Rules • Approximate a definite integral using Simpson’s Rule • Analyze the approximation error in the Trapezoidal Rule and Simpson’s Rule The Midpoint Rule Definition 1 (Midpoint Rule) Rb a f (x)dx ≈ M ID(n), where M ID(n) = n X f (xi )∆x i=1 ∆x = b−a n and xi is the midpoint of the ith subinterval. 1 Example 1 Approximate Rπ 0 sin(x)dx using M ID(4). Solution. Since we are using M ID(4), we know ∆x = approximation looks like the following: π−0 4 = π4 . And our f(x) π/4 π/2 3π/4 x π sin(x) Notice that we have four rectangles, and the total area is as follows: π−0 π 3π 5π 7π M ID(4) = sin( ) + sin( ) + sin( ) + sin( ) 4 8 8 8 8 ≈ pi [2.6131] 4 ≈ 2.0523 The Trapezoidal Rule Definition 2 (Trapezoidal Rule) T RAP (n) = Rb a f (x)dx ≈ T RAP (n), where LEF T (n) + RIGHT (n) 2 and LEF T (n) and RIGHT (n) are the left-hand and right-hand Riemann Sums with n subintervals. Example 2 Approximate Rπ 0 sin(x)dx using T RAP (4). 2 Solution. Since we are using T RAP (4), we know ∆x = approximation looks like the following: π−0 4 = π4 . And our f(x) π/4 π/2 3π/4 x π sin(x) Notice that we have four rectangles, and the total area is as follows: (sin(0)+sin( π4 )+sin( π2 )+sin( 3π4 ))+(sin( π4 )+sin( π2 )+sin( 3π4 )+sin(π)) π−0 T RAP (4) = 4 2 pi 4.8284 ≈ 4 2 ≈ 1.8961 Simpson’s Rule Definition 3 (Simpson’s Rule) SIM P (n) = Rb a f (x)dx ≈ SIM P (n), where 2M ID(n) + T RAP (n) 3 for M ID(n) and T RAP (n) as above. 3 Example 3 Approximate Rπ 0 sin(x)dx using SIM P (4). Solution. By what we have done previously, SIM P (4) = = 2M ID(4) + T RAP (4) 3 2(2.0523) + 1.8961 3 ≈ 2.00023 Error Estimates Theorem 1 Error Estimates for the Trapezoidal Rule and Simpson’s Rule. • If f has a continuous second derivative on [a, b], then the error ET in Rb approximating a f (x)dx by the Trapezoidal Rule is ET ≤ (b − a)3 [max |f 00 (x)|] , 12n2 a≤x≤b • Moreover, if f has a continuous fourth derivative on [a, b], then the Rb error ES in approximating a f (x)dx by Simpson’s Rule is ES ≤ (b − a)5 (4) max |f (x)| , 180n4 4 a≤x≤b Example 4 Bound the Error in approximating and SIM P (4). Rπ 0 sin(x)dx by T RAP (4) Solution. T RAP (4): Let f (x) = sin(x). Then f 0 (x) = cos(x) f 00 (x) = − sin(x) We need to maximize f 00 (x), so we find critical points by looking at f (3) (x) f (3) (x) = − cos(x) Critical Points: − cos(x) = 0 =⇒ x = π/2 Therefore we have three points to check, 0, π/2, and π. f 00 (0) = 0 f 00 (π/2) = −1 f 00 (π) = 0 This gives that max |f 00 (x)| = 1 on the interval [a, b]. So, we have ET ≤ (π − 0)3 ·1 12(4)2 =⇒ ET ≤ π3 ≈ .16149 192 SIM P (4): Similarly to the error bound for T RAP (4), we find critical points for the fourth derivative of sin(x) f (4) (x) = sin(x) f (5) (x) = cos(x) Sritical Points: cos(x) = 0 =⇒ x = π/2 5 Again, we have three points to consider 0, π/2, and π. f (4) (0) = 0 f (4) (π/2) = −1 f (4) (π) = 0 This gives that max |f (4) (x)| = 1 on the interval [a, b]. So, we have (π − 0)5 ES ≤ ·1 180(4)4 =⇒ ES ≤ 6 π5 ≈ .00664 46080