Mth. Numericl Integrtion Lrson Section. This section looks t couple of methods for pproimting definite integrls numericlly. The gol is to get good pproimtion of the definite integrl in problems where n ntiderivtive of f() is not known. f() d; this becomes necessry Trpezoidl Rule. Suppose f is continuous on the intervl [, b]. Prtition the intervl [, b] into n equl subintervls with the prtition = 0 < < < <... < n < n = b where k k =, = b n nd so k = + k. Then f() d (b ) n [f( 0) + f( ) + f( ) +... + f( n ) + f( n )] nd, s n, the right-hnd side pproches f() d. The following emple will compre using simple rectngles nd the trpezoidl rule to estimte the re under curve. Emple. () Use lower sum to pproimte the re of the region under the curve y = 0.5 + 0.8 for with four rectngles of equl width. (b) Use the trpezoidl rule to pproimte the re of the region under the curve y = 0.5 + 0.8 for with n =. (c) The lower sum rectngles re shown below to the left, nd the pproimting trpezoids re below to the right. Which (the rectngles or trpezoids) ppers to provide better pproimtion? Use the Fundmentl theorem of clculus to determine the ctul re, nd then determine how ccurte the estimtes in () nd (b) re. y y
Solution: () Ech of the rectngles hs bse 0.5, nd the heights re: (0.5)( ) + 0.8 =.00, (0.5)(.5 ) + 0.8 =.95 (0.5)( ) + 0.8 =.800, nd (0.5)(.5 ) + 0.8 =.95 respectively. Therefore, the sum of the re of the rectngles is A = (0.5)(.00) + (0.5)(.95) + (0.5)(.800) + (0.5)(.95) = (0.5)(.00 +.95 +.800 +.95) =.975 Thus the lower sum is.975 (b) Using the trpezoidl rule with f() = 0.5 + 0.8, =, b = nd n = we compute f() d (b ) n [f( 0) + f( ) + f( ) + f( ) + f( )] = ( ) [f() + f(.5) + f() + f(.5) + f()] () = (0.5)[.00 + (.95) + (.800) + (.95) + 5.00] = (0.5)(.90) = 5.9750 Thus the trpezoidl rules sys the re is pproimtely 5.9750 (c) From the grphs, we know the ctul re is somewht lrger thn the lower sum, nd it looks to be very close to the sum of the res of the trpezoids. (Note tht the trpezoids were intentionlly drwn with thick green borders so tht comprison with the top of the trpezoids nd the grph of the function could be seen). So, from the grphs, we deduce.975 ctul re, nd we know ctul re 5.9750. From the Fundmentl theorem of clculus, we know the ctul re, A, is A = (0.5 + 0.8) = 0.5 + 0.8 = [9(0.5) + (0.8)] [ ] 0.5 + 0.8 5.9 So the lower sum underestimted the ctul re by pproimtely 5.9.975 = 0.958, nd the trpezoidl rule ws off by pproimtely 5.9 5.9750 = 0.07. Generlly, you will not be ble to know whether the trpezoids underestimte or overestimte the ctul integrl. A couple of generl observtions from the previous emple. The trpezoidl rule will usully provide much better estimte thn using right endpoints or left endpoints with n equl number of subintervls. However, in the event you cn use the Fundmentl theorem of clculus to evlute n integrl, you should of course use it. Finlly, if you cnnot find n ntiderivtive to evlute n integrl nd you use the trpezoidl rule, it would be relly useful to know how ccurte your nswer is. This is ddressed in the net result.
Theorem. (Trpezoidl Rule Error) Suppose f hs continuous second derivtive on the intervl [, b], then the bsolute error E in pproimting stisfies E (b ) n [m f () ], b. f() d by the Trpezoidl rule The right-hnd side in the trpezoidl rule error formul gives us worst-cse scenrio for the error; tht is the ctul error will usully be somewht smller thn the right hnd side vlue, but will never eceed the right hnd side vlue. Emple. () Determine the mimum error predicted by the trpezoidl rule error formul for [0.5 + 0.8] d using n = s ws done in Emple. (b) Wht vlue of n (number of trpezoids) would be needed to gurntee the error in estimting the intgrl [0.5 + 0.8] d does not eceed 0.000. Solution: () We will use the formul for E with f() = 0.5 + 0.8, n =, = nd b =. First, we find f () = (0.5) =.0 nd so the mimum vlue of f () on the intervl is.0. Therefore, E ( ).0 [.0] = ( ) 0.07 (b) We hve E ( ) (n ) [.0], nd so we solve 0.000 = ( ) (.0) (n ) which mens n = ( ) (0.000) [.0] n.7 8.5 We lwys go up to the net higher whole number when n is not whole number, so we would use n = 8. In prt () of the previous emple, the predicted mimum error ws ectly equl to the ctul error, it will usully be the cse tht the ctul error is less thn the predicted mimum error (which is the worst cse scenrio). Emple. () Use the trpezoidl rule with n = to estimte π 0 sin d. (b) Use the trpezoidl error formul to determine the lrgest possible error you would epect in your nswer to () (you will be given the error formuls for Simpson s Rule nd the Trpezoidl Rule if needed on the finl test)?
Solution: () According to the trpezoidl rule with n =, we hve π 0 sin() d π 0 [sin(0) + sin(π/) () + sin(π/) + sin(π/) + sin(π/) + sin(5π/) + sin(π)] = π [0 + + + + + + 0].95 (b) For this question f () = sin nd so the mimum of f () for 0 π is. Therefore, the ctul error E stisfies ( ) (b ) E = m n f () = π 0 π ( ) 0.0777 In this cse, we cn use the Fundmentl theorem of clculus to determine π π sin d = cos = ( ) = 0 nd so E.95 = 0.0, nd so we note this does not eceed the bound of 0.0777 we found using the trpezoidl rule error formul. 0 An importnt rule tht uses res under prbols to provide numericl pproimtions definite integrls is clled Simpson s rule. It tends to work rel well for functions tht hve nice higher order derivtives. Simpson s Rule. Suppose f is continuous on the intervl [, b]. Prtition the intervl [, b] into n equl subintervls, where n is n even integer, with the prtition = 0 < < < <... < n < n = b where k k =, = b n nd so k = + k. Then f() d (b ) n [f( 0) + f( ) + f( ) + f( )... + f( n ) + f( n ) + f( n )] nd, s n, the right-hnd side pproches f() d. Note tht the coefficients nd in Simpson s rule lternte, nd follow the pttern...
The following provides n emple using Simpson s rule where we do not know n ntiderivtive. Emple. Use Simpson s rule to estimte 9 8 9 sin() d with n =. Solution: First = 9 8 = 0.5. Then 0 = 8, = 8.5, = 8.50, = 8.75 nd = 9. Then Simpson s rule sys 9 8 9 sin() 9 sin() d = 9 d 8 ( ) [ 9 8 sin((8)) 9 () 8 + sin((8.5)) 8.5 + sin((8.75)) + sin((9)) ] 8.75 9 = 9 [ sin(8.00) + sin(9.50) + sin(5.00) 8 8.5 8.50 ] + sin(5.50) 8.75 0.07798 + sin(5.00) 9 + sin((8.50)) 8.50 As with the Trpezoidl rule, it is importnt to determine how ccurte our nswers re when using Simpson s rule. The following error formul cn help you do this. Theorem. (Simpson s Rule Error) Suppose f hs continuous fourth derivtive on the intervl [, b], then the bsolute error E in pproimting f() d by Simpson s rule stisfies E (b )5 80n [m f () () ], b. The different prts in the penultimte emple provides prctice on the vrious rules presented in this section. Emple 5. () Estimte (b) Estimte sin( )d with n = subintervls using the trpezoidl rule. sin( )d with n = subintervls using Simpson s rule.
(c) Use the error formul for Simpson s rule to determine the lrgest error you would epect in evluting 5 d using Simpson s rule with n = 0, 000 subintervls? (d) Use the error formul for the trpezoidl rule to determine the lrgest error you would epect in evluting 5 d using the trpezoidl rule with n = 0, 000 subintervls? (e) Use the trpezoidl rule error formul to find n so tht the error in pproimting using the trpezoidl rule does not eceed 0.0000. (f) Use Simpson s rule error formul to find n so tht the error in pproimting Simpson s rule does not eceed 0.0000. 8 8 d d using Solution: () Using the trpezoidl rule with n = sin( )d (5 ) () [sin( ) + sin(0 / ) + sin( / ) + sin( ) + sin( / ) + sin( / ) + sin(5 )] [.0779].0777. (b) Using Simpson s rule with n = sin( )d (5 ) () [sin( ) + sin(0 / ) + sin( / ) + sin( ) + + sin( / ) + sin( / ) + sin(5 )] [.059509].897. 9 Note Wolfrm Alph provides n pproimte vlue of.055 for (c) f () () = 0, so m f () () = 0() for. Thus E ( )5 80(0000 ) 0 = 0. (d) f () = 0. Thus m f () = 0( ) for. Then E ( ) 50 =.0000009 (0000 ) sin( ) d.
(e) f = nd so m f () = / for 8. Solve n.0000 to find n 70.8 nd n is n integer so we choose n = 7. (f) f () = 5 nd so m f () = / 5 = / for 8. Solve 5 80n.0000 to find n.9 (nd n even) nd so we choose n =. The finl emple illustrtes the vrious types of questions you my see involving the trpezoidl rule. Emple. () Use n upper sum to pproimte the re of the region under the curve y = for with si rectngles of equl width. + (b) Use the trpezoidl rule to pproimte the re of the region under the curve y = + for with n =. (c) By compring the grphs given below, does one method pper to give significntly more ccurte estimte of the re thn the other? If so, which one is better? (d) Use the error formul for the trpezoidl rule to determine the mimum possible error tht occurred in (b). (e) Use the error formul for the trpezoidl rule to determine the the smllest possible n in the trpezoidl rule tht could be used to pproimte the ctul re to within 0.00005. y y 5 5 5 5
Solution: () Ech of the rectngles hs bse 0.5, nd so the upper sum is U = ( (0.5) + +.5 + + + +.5 + + + + ).5 +.90 (b) According to the trpezoidl rule, we hve (b ) f() d n [f( 0) + f( ) + f( ) + f( ) + f( ) + f( 5 ) + f( )] ( ) = [f() + f(.5) + f() + f(.5) + f() + f(.5) + f()] () = ( + +.5 + + + +.5 + + + +.5 + + ) +.08 (c) From the grph, it is cler tht the ctul re is less thn the upper sum, nd so the ctul re is less thn.90, however, it is lso cler tht the trpezoids provide much better estimte of the ctul re, so the ctul re is.08. (d) The error E in the Trpezoidl rule stisfies E (b ) n In our cse = nd b =, n = nd we find m{ f () : b}. f () = ( + ), f () = ( + ) = ( + ) Clerly f () is decresing function on [, ] so its mimum vlue on this intervl occurs t. Therefore, ( ) E ( ) ( + ) 0.00 Tht is, the ctul re will be within 0.00 of the trpezoidl rule estimte of.08 tht mens the ctul re is between.08 0.00 nd.08 + 0.00, tht is.878 Actul Are.78 (e) Given desired error E = 0.00005 (t most) we solve 0.00005 = ( ) (n ) ( + ) n = ( ) (0.00005) ( + ) = 9.8 nd so n 9.8 0. nd so we choose n = (for the trpezoidl rule, lwys go up to the net higher whole number in the cse n is not whole number).