Midpoint Approximtion Sometimes, we need to pproximte n integrl of the form R b f (x)dx nd we cnnot find n ntiderivtive in order to evlute the integrl. Also we my need to evlute R b f (x)dx where we do not hve formul for f (x) but we hve dt describing set of vlues of the function. Review We might pproximte the given integrl using Riemnn sum. Alredy we hve looked t the left end-point pproximtion nd the right end point pproximtion to R b f (x)dx in Clculus. We lso looked t the midpoint pproximtion M: Midpoint Rule If f is integrble on [, b], then f (x)dx M n = nx f ( x i ) x = x(f ( x ) + f ( x ) + + f ( x n)), i= where x = b n nd x i = +i x nd x i = (x i +x i ) = midpoint of [x i, x i ].
Midpoint Approximtion Exmple Use the midpoint rule with n = 6 to pproximte R 4 (= ln(4) =.86946) Fill in the tbles below: x = 4 6 = x dx. x i x 0 = x = / x = x = 5/ x 4 = x 5 = 7/ x 6 = 4 x i = (x i + x i ) = 5/4 = 7/4 = 9/4 4 = /4 5 = /4 6 = 5/4 f ( x i ) = x i 4/5 4/7 4/9 4/ 4/ 4/5 M 6 = P 6 f ( x ˆ i) x = 4 + 4 + 4 + 4 + 4 + 4 5 7 9 5 =.769477
Trpezoidl Rule We cn lso pproximte definite integrl R b f (x)dx using n pproximtion by trpezoids s shown in the picture below for f (x) 0 The re of the trpezoid bove the intervl [x i, x i+ ] is x Trpezoidl Rule If f is integrble on [, b], then h (f (xi )+f (x i+ ) f (x)dx T n = x (f (x0) + f (x) + f (x) + + +f (xn ) + f (xn)) i. where x = b n nd x i = + i x nd.
Trpezoidl Rule x f (x)dx Tn = (f (x 0 ) + f (x ) + f (x ) + + +f (x n ) + f (xn)) where x = b n nd x i = + i x nd. Exmple Use the trpezoidl rule with n = 6 to pproximte R 4 dx. (= x ln(4) =.86946) x = 4 6 = x i x 0 = x = / x = x = 5/ x 4 = x 5 = 7/ x 6 = 4 x i x 0 = x = / x = x = 5/ x 4 = x 5 = 7/ x 6 = 4 f (x i ) = x i
Trpezoidl Rule x f (x)dx Tn = (f (x 0 ) + f (x ) + f (x ) + + +f (x n ) + f (xn)) where x = b n nd x i = + i x nd. Exmple Use the trpezoidl rule with n = 6 to pproximte R 4 dx. (= x ln(4) =.86946) x = 4 6 = x i x 0 = x = / x = x = 5/ x 4 = x 5 = 7/ x 6 = 4 x i x 0 = x = / x = x = 5/ x 4 = x 5 = 7/ x 6 = 4 f (x i ) = x i / / /5 / /7 /4 T 6 = x = 4 ( + =.405574. (f (x0) + f (x) + f (x) + f (x) + f (x4) + f (x5) + f (x6)) + + + + + ) 4 5 7
Error of Approximtion The error when using n pproximtion is the difference between the true vlue of the integrl nd the pproximtion. The error for the midpoint pproximtion bove bove is E M = Z 4 dx M6 =.86946.769477 = 0.009608 x The error for the trpezoidl pproximtion bove is E T = Z 4 dx T6 =.86946.405574 = 0.09068 x Error Bounds If f (x) K for x b. Let E T nd E M denote the errors for the trpezoidl pproximtion nd midpoint pproximtion respectively, then E T K(b ) K(b ) nd E n M 4n
Error of Approximtion Error Bounds If f (x) K for x b. Let E T nd E M denote the errors for the trpezoidl pproximtion nd midpoint pproximtion respectively, then Exmple () pproximtion of R 4 f (x) =, x K(b ) E T nd E M n K(b ) 4n Give n upper bound for the error in the trpezoidl dx when n = 0. x f (x) = x, f (x) = x We cn use the bove formul for the error bound with ny vlue of K for which f (x) K for x 4. Since f (x) = f (x) = x is decresing function on the intervl [, 4], we hve tht f (x) f () = on the intervl [, 4]. So we cn use K = in the formul for the error bound bove. Therefore when n = 0, T 0 Z 4 x dx = E K(b ) (4 ) T = = 0.045 n (0) Note tht the bound for the error given by the formul is conservtive since it turns out to give E T 0.045 when n = 0, compred to true error of E T = 0.00696667.
Error of Approximtion K(b ) E T nd E M n K(b ) Exmple(b) Give n upper bound for the error in the midpoint pproximtion of R 4 dx when n = 0. x As bove, we cn use K = to get E M 4n K(b ) 4n = () 4(0) = 0.05. (c) Using the error bounds given bove determine how lrge should n be to ensure tht the trpezoidl pproximtion is ccurte to within 0.00000 = 0 6? We wnt E T 0 6. We hve E T K(b ), where K = since f (x) for x 4. n Hence we will certinly hve E T 0 6 if we choose vlue of n for which (4 ) n 0 6. Tht is (06 )(7) n q (0 or n 6 )(7) =., n = will work.
Simpson s Rule We cn lso pproximte definite integrl using prbols to pproximte the curve s in the picture below. [note n is even]. Three points determine unique prbol. We drw prbolic segment using the three points on the curve bove x 0, x, x. We drw second prbolic segment using the three points on the curve bove x, x, x 4 etc... The re of the prbolic region beneth the prbol bove the intervl [x i, x i+ ] is x [f (x i ) + 4f (x i ) + f (x i+ )]. We estimte the integrl by summing the res of the regions below these prbolic segments to get Simpson s Rule for even n: x f (x)dx Sn = (f (x 0 ) + 4f (x ) + f (x ) + 4f (x ) + f (x 4 ) + + f (x n ) + 4f (x n ) + f (xn)) where x = b n nd x i = + i x nd. In fct we hve S n = Tn + Mn.
Simpson s Rule x f (x)dx Sn = (f (x 0 ) + 4f (x ) + f (x ) + 4f (x ) + f (x 4 ) + + f (x n ) + 4f (x n ) + f (xn)) Exmple Use Simpson s rule with n = 6 to pproximte R 4 ln(4) =.86946) Fill in the tbles below: dx. (= x x = 4 = 6 x i x 0 = x = / x = x = 5/ x 4 = x 5 = 7/ x 6 = 4 f (x i ) = x i / / /5 / /7 /4 S 6 = x (f (x0) + 4f (x) + f (x) + 4f (x) + f (x4) + 4f (x5) + f (x6)) = h i + 8 + + 8 + + 8 + =.876984 6 5 7 4 The error in this estimte is E S = Z 4 dx S6 = x.86946.876984 = 0.0040405
Error Bound Simpson s Rule Error Bound for Simpson s Rule Suppose tht f (4) (x) K for x b. If E S is the error involved in using Simpson s Rule, then K(b )5 E S 80n 4 Exmple How lrge should n be in order to gurntee tht the Simpson rule estimte for R 4 dx is ccurte to within 0.00000 = x 0 6? f (x) =, f (x) =, f (x) =, x x x f (4) (x) = 4 4 (for k 4 ) = K x 5 We hve E S 4()5 80n 4 f () (x) = ( ) x 4, We wnt E S 0 6, hence if we find vlue of n for which 4() 5 0 6 it is gurnteed tht E 80n 4 S 0 6. q From 4()5 0 6 we get tht 0 6 4()5 n 4 or n 4 0 80n 4 80 6 4()5 = 75. 80 n = 76 will work. This is conservtive upper bound of the error, the ctul error for n = 76 is 8 0 8