Chpter 4 Numericl integrtion Contents 4.1 Definite integrls.............................. 4. Closed Newton-Cotes formule..................... 4 4. Open Newton-Cotes formule...................... 8 4.4 Guss qudrture............................. 8 4.5 Composite methods............................ 8 4.1 Definite integrls The definite integrl of function f on the intervl [,b] is written s nd cn be defined s the limit of the Riemnn series i.e. s the re under the curve (x,y = f(x)). f(x)dx (4.1) (b )/h f(x)dx = lim hf(+(i 1)h), h 0 i=1 f(x) h b x Hence, numericl integrtion is often clled qudrture (i.e. computtion of n re under curve).
4 4. Closed Newton-Cotes formule The definite integrl of function exists even if there is no nlytic ntiderivtive function F(x) such tht d F(x) = f(x). dx 4. Closed Newton-Cotes formule The definite integrl (4.1) cn be pproximted using the polynomil interpolting f(x) through n equispced points (x k ), leding to f(x)dx 4..1 Trpezium rule n w k f(x k ) with x k = +(k 1) b n 1. This is the simplest numericl method for evluting definite integrl. It clcultes the re of the trpezium formed by pproximting f(x) using liner interpoltion. 000 111 0000 1111 00000 11111 000000 111111 0000000 1111111 f() P(x) f(b) f(x) b x f(x)dx b (f()+f(b)). (4.) Thus, the trpezium rule cn be obtined by integrting the liner interpoltion function (Check tht P(x) = f() x b b +f(b)x b f(x)dx P(x)dx leds to (4.).) over the intervl [,b]. Mesure of the error: From Eqution (.4), we know the error in the liner interpoltion, f(x) = P(x)+ 1 f (ξ(x))(x )(x b), ξ(x) [,b]. Therefore, 1 f(x)dx = P(x)dx+ f (ξ(x))(x )(x b)dx. So, the error in the trpezium rule is equl to E = 1 f (ξ(x))(x )(x b)dx. To evlute this integrl, we shll mke use of the following theorem (generlistion of the Men Vlue Theorem).
Chpter 4 Numericl integrtion 5 Theorem 4.1 (Weighted Men Vlue for Integrls) If h C[,b], if the integrl of g(x) exists on [,b], nd if g(x) does not chnge sign on [,b], then there exists c [,b] such tht Hence, 1 h(x)g(x)dx = h(c) f (ξ(x))(x )(x b)dx = f (c) since (x )(x b) 0 on the intervl [,b]. E = 1 f (c) 0 = 1 [ u f (c) u (b ) g(x)dx. (x )(x b)dx u(u (b ))du with u = x, ] b 0 = f (c) (b ). 1 Thus, the error in the trpezium method scles with the cube of the size on the intervl. (Note tht this method is exct for liner functions.) We cn generte other integrtion rules by using higher order Lgrnge polynomils. f(x)dx P(x)dx = = n f(x k )L k (x)dx n f(x k ) where w k = L k (x)dx re clled weights. f (n) (ξ(x)) n The error is given by (x x k )dx. n! L k (x)dx = n w k f(x k ), This method provides mens of finding the weights nd error terms. However, their evlution becomes more nd more complex with incresing n. (Theorem 4.1 cnnot be used to n evlute the error since (x x k ) chnges sign for n.) 4.. Method of undetermined coefficients Alterntive wy of evluting Newton-Cotes integrtion formule. To illustrte this method, let us derive the trpezium rule gin. Trpezium rule We wish to find n pproximtion of the form f(x)dx w 1 f()+w f(b). Since, we hve two unknown prmeters, w 1 nd w, we cn mke this formule exct for liner functions (i.e. functions re of the form αx + β). So, the error term must be of the form Kf (ξ) for some ξ (,b).
6 4. Closed Newton-Cotes formule Hence, we seek qudrture rule of the form f(x)dx = w 1 f()+w f(b)+kf (ξ), ξ (,b). Tofindw 1 ndw weneedtoensurethttheformulisexctforlllinerfunctions. However, using the principle of superposition, it is sufficient to mke this work for ny two independent liner polynomils (i.e. polynomils of degree one t most). E.g. choose the two independent polynomils f 1 nd f x. For f 1 : for f x : Solving these simultneous equtions gives dx = w 1 +w = b ; xdx = w 1 +bw = b. w 1 = w = b. To find the vlue of K, we cn use ny qudrtic function so tht f (ξ) is non-zero constnt, independent of the unknown ξ. E.g. tke f x, Hence, x dx = b = b ( +b ) +K (f = ), K = b b ( +b ), [ 1 ( = (b ) +b+b ) 1 ( +b )], [ = (b ) 1 ( b+b )] = (b ), 6 6 f(x)dx = b K = (b ). 1 in greement with 4..1 (but esier to derive). (f()+f(b)) (b ) f (ξ), ξ (,b), (4.) 1 Simpson s rule Three points integrtion rule derived using the method of undetermined coefficients. Suppose tht we dd qudrture point t the middle of the intervl [,b], To void lgebr, substitute x = +b ( ) +b f(x)dx w 1 f()+w f +w f(b). +u nd define h = b so tht the integrl becomes F(u)du w 1 F()+w F(0)+w F(h), with F(u) = f(x).
Chpter 4 Numericl integrtion 7 Since we hve three unknowns, we cn mke this formul exct for ll qudrtic functions; so, let us use, e.g., F 1, F u nd F u. F 1 F u F u w = h w 1 w = h h = 4 h. Hence we obtin the pproximtion which trnsltes into This is clled Simpson s rule. du = h = w 1 +w +w ; udu = 0 = w 1 +hw w 1 = w ; u du = h = h w 1 +h w w 1 = w = h ; F(u)du h F()+ 4h F(0)+ h F(h), f(x)dx b 6 [ f()+4f ( +b ) ] +f(b). As this formul is exct for ll qudrtic functions, we expect the error to be of the form KF (ξ). However, if we exmine F u, the integrl h [ () +4 0+h ] = 0 K 0. u du = 0 nd Simpson s rule gives Therefore Simpson s rule is exct for cubic functions s well. Consequently, we try n error term of the form KF (iv) (ξ), ξ (,h). To find the vlue of K use, e.g., F(u) x 4 (with F (iv) (ξ) = 4!, independent of ξ). u 4 du = h5 5 = h [ () 4 +h 4] [ 1 +4!K 4!K = h 5 5 1 ] = 4h5 15, K = h5 90. Simpson s rule is fifth-order ccurte: the error vries s the fifth power of the width of the intervl. Simpson s rule is given by f(x)dx = b 6 [ f()+4f ( +b ) +f(b) ] (b )5 880 f(iv) (ξ), ξ (,b). (4.4) Exmple 4.1 Mteril covered in clss. Plese, see your lecture notes. Closed Newton-Cotes formul of higher order cn be derived using more equispced intermedite points (n = : trpezium; n = : Simpson). As observed for Simpson s rule, the error for n odd is of order (b ) n+ rther thn (b ) n+1, due to symmetry.
8 4. Open Newton-Cotes formule 4. Open Newton-Cotes formule Closed Newton-Cotes formule such s (4.) nd (4.4) include the vlue of the function t the endpoints. By contrst, open Newton-Cotes formule re bsed on the interior points only. Midpoint rule. For exmple, consider the open Newton-Cotes formul ( ) +b f(x)dx w 1 f. Agin, we cn substitute u = x +b nd h = b ; F(u)du w 1 F(0). This formul must hold for constnt functions. So, tking, e.g. F 1 h = w 1. However, since for F(u) u, F(u)du = 0, the qudrture rule is exct for liner functions s well. So, we look for n error of the form KF (ξ), ξ (,h); F(u)du = hf(0)+kf (ξ), ξ (,h). Substitute F(u) = u, h = 0+K K = h. ( +b f(x)dx = (b )f )+ (b ) f (ξ), ξ (,b). (4.5) 4 Sme order s trpezium nd coefficient of the error smller (hlved). Exmple 4. Mteril covered in clss. Plese, see your lecture notes. 4.4 Guss qudrture There is no necessity to use equispced points. By choosing the qudrture points x k ppropritely we cn derive n-points methods of order n+1 (i.e. error vries s (b ) n+1 ), exct for polynomils of degree (n 1). These re clled Guss formule nd cn give stunning ccurcy. However, for n, the vlues of x k (roots of Legendre polynomils) nd the weights w k re non rtionl. 4.5 Composite methods Disdvntge of higher order methods: Since higher order methods re bsed on Lgrnge interpoltion, they lso suffer the sme weknesses. While very ccurte for functions with well-behved higher order derivtives, they becomes inccurte for functions with unbounded higher derivtives.
Chpter 4 Numericl integrtion 9 Therefore, it is often sfer to use low order methods, such s trpezium nd Simpson s rules. While these qudrture rules re not very ccurte on lrge intervls (error vrying s (b ) nd s (b ) 5 ), ccurte pproximtions cn be obtined by breking the intervl [,b] into n subintervls of equl width h. 4.5.1 Composite trpezium rule Split the intervl [,b] into n intervls of width h = b, i.e. consider n + 1 equispced n points x j = +jh, j = 0,...,n. The subintervl j is [x j,x j+1 ], j = 0,...,n 1. f(x) x 0 x 1 x x j h x j+1 x n b x n 1 f(x)dx = n 1 { } h f(x)dx = x j [f(x j)+f(x j+1 )] h 1 f (ξ j ) xj+1 ξ j (x j,x j+1 ), Error: since f(x)dx = h [f()+f(x 1)]+ h [f(x 1)+f(x )]+... + h [f(x n )+f(x n 1 )]+ h [f(x n 1)+f(b)] minf (ξ j ) K = 1 n 1 f (ξ j ) mxf (ξ j ), j n j h [ f (ξ 0 )+f (ξ 1 )+...+f (ξ n 1 ) ]. 1 nd f is continuous, there exits ξ (,b) with f (ξ) = K (nlogous to the intermedite vlue theorem). Hence, the totl error is of the form E = nh 1 f (ξ) = b 1 h f (ξ) since b = nh. We cn rewrite the composite trpezium rule s f(x)dx = h n 1 f()+ f(x j )+f(b) b 1 h f (ξ), ξ (,b). (4.6) j=1 Composite trpezium rule hs error of order h, compred to h for ech individul intervl.
0 4.5 Composite methods 4.5. Composite Simpson s rule Consider n/ intervls [x j,x j+ ], j = 0,...,n/ 1, of width h = b n/ qudrture points x j = +jh, j = 0,...,n. with equispced f(x) x 0 x 1 x x x 4 x j x j+1 x j+ h x n b x f(x)dx = = n/ 1 n/ 1 x j+ x j f(x)dx, { h [f(x j)+4f(x j+1 )+f(x j+ )] h5 90 f(iv) (ξ j ) } ξ j [x j,x j+ ], f(x)dx = h [f()+4f(x 1)+f(x )]+ h [f(x )+4f(x )+f(x 4 )]+... + h [f(x n )+4f(x n 1 )+f(b)] h5 [ ] f (iv) (ξ 0 )+f (iv) (ξ 1 )+...+f (iv) (ξ 90 n/ 1 ). As for the composite trpezium rule, there exists ξ (,b) such tht n/ 1 n f(iv) (ξ) = f (iv) (ξ j ). Using lso h = b, we cn rewrite the composite Simpson s rule s n f(x)dx = h f()+ n/ 1 j=1 n/ 1 f(x j )+4 So, the composite Simpson s rule is 4 th order ccurte. f(x j+1 )+f(b) b 180 h4 f (iv) (ξ), ξ (,b). (4.7)