NUMERICAL INTEGRATION 1 Introduction The inverse process to differentition in clculus is integrtion. Mthemticlly, integrtion is represented by f(x) dx which stnds for the integrl of the function f(x) with respect to the independent vrible x, evluted between the limits x = to x = b. The function f(x) in the integrl is referred to s the integrnd. The vlue of the integrl I(f) is number when nd b re numbers. Grphiclly, the vlue of the integrl corresponds to the shded re under the curve of f(x) between nd b. The function to be differentited or integrted will typiclly be in one of the following three forms: A simple continuous function such s polynomil, n exponentil, or trigonometric function. A complicted continuous function tht is difficult or impossible to integrte directly. A tbulted function where vlues of x nd f(x) re given t number of discrete points, s is often the cse with experimentl or field dt. In the first cse, the derivtive or integrl of simple function my be evluted nlyticlly using clculus. For the second cse, nlyticl solutions re often imprcticl, nd sometimes impossible, to obtin. In these instnces, s well s in the third cse of discrete dt, pproximte methods must be employed. This chpter is devoted to the most common pproches for numericl integrtion. We begin with the Newton-Cotes formuls. These reltionships re bsed on replcing complicted function or tbulted dt with simple polynomil tht is esy to integrte. Three of the most widely used Newton-Cotes formuls re discussed in detil: the trpezoidl rule, Simpson s 1/3 rule, nd Simpson s 3/8 rule. All these formuls re designed for cses where the dt to be integrted is evenly spced. Newton s cotes formuls cn be used for tbulted dt s well s in integrting functions numericlly. where F n (x) is the polynomil of the form f(x) dx F n (x) dx F n (x) = o + 1 x + x +... + n x n Two dditionl techniques when the function is given re lso considered. The first is bsed on Richrdson s extrpoltion, the second method is clled Guss qudrture. 1
Newton s cotes integrtion formuls Closed nd open forms of the Newton-Cotes formuls re vilble. The closed forms re those where the dt points t the beginning nd end of the limits of integrtion re known (prt of figure below). The open forms hve integrtion limits tht extend beyond the rnge of the dt (prt b of sme figure). Open Newton-Cotes formuls re not generlly used for definite integrtion. This chpter emphsizes the closed forms..1 The Trpezoidl rule The trpezoidl rule is the first of the Newton-Cotes closed integrtion formuls. It corresponds to the cse where the polynomil is first-order. recll tht Newton s form of interpolting polynomils with two points x = nd x = b yields ( ) f(b) f() F 1 (x) = f() + f[, b](x ) = f() + (x ) b The re under this stright line is n estimte of the integrl of f(x) between the limits nd b: I(f) ( f(b) f() f() + b ) (x ) dx = f() + f(b) (b ) When we employ the integrl under stright-line segment to pproximte the integrl under curve, we obviously cn incur n error tht my be substntil. An estimte for the locl trunction error of single ppliction of the trpezoidl rule is E t = 1 1 f (η)(b ) 3 where η lies somewhere in the intervl from to b. This eqution indictes tht if the function being integrted is liner, the trpezoidl rule will be exct. Otherwise, for functions with second- nd higherorder derivtives (tht is, with curvture), some error cn occur.
Note: The error in the trpezoidl rule cn be derived using the following theorem: Let p n (x) be n interpolting polynomil for given set of dt points y k = f(x k ), for distinct grid points x k, k = 1,...n + 1. Let = min(x k ) nd b = mx(x k ), nd suppose tht f(x) is n + 1 times differentible. Then for ech x ɛ [, b], there exist η ɛ [, b] such tht f(x) = p n (x) + f (n+1) (η) (n + 1)! (x x 1)...(x x n+1 ) We cn then clculte the error in the integrl for n + 1 = s E = f (η)!.1.1 The Multiple-Appliction Trpezoidl Rule (x )(x b) = f (η) (b )3 1 One wy to improve the ccurcy of the trpezoidl rule is to divide the integrtion intervl from to b into number of segments nd pply the method to ech segment. The res of individul segments cn then be dded to yield the integrl for the entire intervl. The resulting equtions re clled multipleppliction, or composite, integrtion formuls. There re n segments of equl width x x 1 f(x) dx + x3 x f(x) dx +... + xn+1 x n f(x) dx f(x 1) + f(x ) h + f(x ) + f(x 3 ) h +... f(x n) + f(x n+1 ) h or, grouping terms [ ] h n f() + f(b) + f(x i ) An error for the multiple-ppliction trpezoidl rule cn be obtined by summing the individul errors for ech segment to give (b )3 E t = 1n 3 i= n f (η i ) where f (η i ) is the second derivtive t point η i locted in segment i. This result cn be simplified by estimting the men or verge vlue of the second derivtive for the entire intervl s i=1 3
f n f (η i ) (b )3 E t f 1n Thus, if the number of segments is doubled, the trunction error will be qurtered. Notes: i=1 For individul pplictions with nicely behved functions, the multiple-segment trpezoidl rule is just fine for ttining the type of ccurcy required in mny engineering pplictions. If high ccurcy is required, the multiple-segment trpezoidl rule demnds gret del of computtionl effort. Although this effort my be negligible for single ppliction, it could be very importnt when () numerous integrls re being evluted or (b) where the function itself is time consuming to evlute. For such cses, more efficient pproches my be necessry. Finlly, round-off errors cn limit our bility to determine integrls. This is due both to the mchine precision s well s to the numerous computtions involved in simple techniques like the multiplesegment trpezoidl rule. Simpson s rule Aside from pplying the trpezoidl rule with finer segmenttion, nother wy to obtin more ccurte estimte of n integrl is to use higher-order polynomils to connect the points. For exmple, if there is n extr point midwy between f() nd f(b), the three points cn be connected with prbol. If there re two points eqully spced between f() nd f(b), the four points cn be connected with third-order polynomil. The formuls tht result from tking the integrls under these polynomils re clled Simpsons rules...1 Simpson s 1/3 rule n Simpsons 1/3 rule results when second-order interpolting polynomil is substituted into f(x) dx F (x) dx If nd b re designted s x 1 nd x 3 nd F (x) is represented by second-order Lgrnge polynomil, the integrl becomes I(f) x3 x 1 [ (x x )(x x 3 ) (x 1 x )(x 1 x 3 ) f(x 1) + (x x 1)(x x 3 ) (x x 1 )(x x 3 ) f(x ) + (x x ] 1)(x x ) (x 3 x 1 )(x 3 x ) f(x 3) dx 4
After integrtion nd lgebric mnipultion, the following formul results: I(f) h 3 [f(x 1) + 4f(x ) + f(x 3 )] = h + b [f() + 4f( 3 ) + f(b)] where, for this cse, h = (b )/. This eqution is known s Simpson s 1/3 rule. The lbel 1/3 stems from the fct tht h is divided by 3. It cn be shown tht single-segment ppliction of Simpson s 1/3 rule hs trunction error of (b )5 E t = 880 f (4) (η) where η lies somewhere in the intervl from to b. Thus, Simpsons 1/3 rule is more ccurte thn the trpezoidl rule. However, comprison with the error from the trpezoidl rule indictes tht it is more ccurte thn expected. Rther thn being proportionl to the third derivtive, the error is proportionl to the fourth derivtive. Consequently, Simpson s 1/3 rule is third-order ccurte even though it is bsed on only three points. In other words, it yields exct results for cubic polynomils even though it is derived from prbol! Proof: To prove this result we extend the expnsion beyond the intervl for resons tht will be pprent shortly between x 1 =, x = + h, x 3 = + h = b, x 4 = + 3h f(x) = p (x) + f[x 1, x, x 3, x 4 ](x x 1 )(x x )(x x 3 ) + f (4) (η) (x x 1 )(x x )(x x 3 )(x x 4 ) 4 where one cn show tht E t = p (x) = f(x 1 ) + f[x 1, x ](x x 1 ) + f[x 1, x, x 3 ](x x 1 )(x x ) +h +h since h = (b )/ then f[x 1, x, x 3, x 4 ](x x 1 )(x x )(x x 3 ) dx = 0 f (4) (η) (x x 1 )(x x )(x x 3 )(x x 4 ) dx = h5 4 90 f (4) (η) E t = (b )5 90 5 f (4) (b )5 (η) = 880 f (4) (η).. The Multiple-Appliction Simpson s 1/3 Rule 5
Just s with the trpezoidl rule, Simpson s rule cn be improved by dividing the integrtion intervl into number of segments of equl width x3 x 1 f(x) dx + h = b n x5 x 3 f(x) dx +... + xn+1 x n f(x) dx Substituting Simpson s 1/3 rule for the individul integrl then combining yields I(f) h n n f() + 4 f(x i ) + f(x j ) + f(b) 3 i=,4,6 j=3,5,7 Notice tht, n even number of segments must be utilized to implement the method. An error estimte for the multiple-ppliction Simpson s rule is obtined in the sme fshion s for the trpezoidl rule by summing the individul errors for the segments nd verging the derivtive to yield..3 Simpson s 3/8 rule E t (b )5 180n 4 f (4) In similr mnner to the derivtion of the trpezoidl nd Simpson s 1/3 rule, third-order Lgrnge polynomil cn be fit to four points nd integrted: to yield f(x) dx F 3 (x) dx I(f) 3h 8 [f(x 1) + 3f(x ) + 3f(x 3 ) + f(x 4 )] where h = (b )/3. This eqution is clled Simpson s 3/8 rule becuse h is multiplied by 3/8. Simpson s 3/8 rule hs n error of (b )5 E t = 6480 f (4) (η) Becuse the denomintor is lrger thn tht for Simpson s (1/3), the 3/8 rule is somewht more ccurte thn the 1/3 rule. Simpson s 1/3 rule is usully the method of preference becuse it ttins third-order ccurcy with three points rther thn the four points required for the 3/8 version. However, the 3/8 rule hs utility when the number of segments is odd. 6
..4 The Multiple-Appliction Simpson s 3/8 Rule When the domin [, b] is divided into n subintervls (where n is t lest 6 nd divisible by 3) Simpson s (3/8) rule cn be generlized to n n X X 3h I(f ) f () + 3 [f (xi ) + f (xi+1 )] + f (xj ) + f (b) 8 i=,5,8 j=4,7,10 3 Guss Qudrture Guss qudrture is technique tht is bsed on evluting the integrl using weighted ddition of the vlues of f (x) t different points (clled Guss points) within the intervl [, b]. Guss qudrture is n open method where the guss points re not eqully spced nd do not include the end points. The loction of the points nd the weights re determined in such wy to minimize the error (in wy tht the right side of the eqution below is exctly equl to the left side when f (x) = 1, x, x,...). Z b f (x)dx I(f ) = n X Ci f (xi ) i=1 The tble below lists the vlues of the coefficients Ci nd the loction of the Guss points xi for i = 1,...6 for = nd b = 1 7
exmple: for n =, = nd b = 1 where f(x)dx C 1 f(x 1 ) + C f(x ) cse f(x) = 1 (1)dx = = C 1 + C cse f(x) = x (x)dx = 0 = C 1 x 1 + C x cse f(x) = x (x )dx = 3 = C 1x 1 + C x cse f(x) = x 3 (x 3 )dx = 0 = C 1 x 3 1 + C x 3 Since some of these equtions re not liner, multiple solutions cn exist. If however, we dd nother condition, sy x 1 nd x should be symmetriclly locted bout the origin (x = x 1 ) then the solution is unique nd note: C 1 = 1 C = 1 x 1 = 3 = 0.5773507 x = 1 3 = 0.5773507 If or b re different thn -1 nd 1 respectively, chnge of vrible cn be mde to chnge the originl bounds to -1 nd 1. x = 1 [t(b ) + + b] dx = 1 (b )dt where f(x) dx = f(x) dx = b ( ) t(b ) + + b (b ) f dt h(t) dt b ( ) t(b ) + + b h(t) = f C i h(t i ) i 4 Richrdson extrpoltion This technique is quite similr to the one used in the previous chpter. estimtes of n integrl to compute third more ccurte estimte. It is bsed on the use of two When n integrl is numericlly evluted with method whose trunction error cn be written in terms of even powers of h, strting with h p, where p is n even number, then the true (unknown) vlue of the integrl I(f) cn be expressed s the sum of the estimte I pp (h) nd the error ccording to f(x)dx = I pp (h) + Ch p + Dh p+ +... 8
Assume the expnsion coefficients to be constnt. We cn get two estimtes of the sme integrl by reducing the size h to h/ f(x)dx = I pp (h/) + C ( ) p ( ) p+ h h + D +... Combining the lst two equtions we get third pproximtion of the integrl of order h p+ I(f) p I pp (h/) I pp (h) p 1 For exmple, consider the estimte nd error ssocited with the ppliction of the composite trpezoidl method I n + E(h) where I(f) is the exct vlue of the integrl, I n is the pproximtion from n n-segment ppliction of the trpezoidl rule with step size h = (b )/n, nd E(h) is the trunction error. (b ) E(h) = f 1 h If we mke n dditionl estimte by reducing the size of the step size from h to h/ doubling by tht the number of intervls between nd b we get fter elimintion of the error, n pproximtion of order h 4 5 Romberg integrtion I(f) I n I n 1 Romberg integrtion is technique tht is bsed on the successive ppliction of the composite trpezoidl rule to obtin more ccurte estimte of the vlue of n integrl. The method cn be explined following the digrm in the figure below The vlue of the integrl is clculted with the composite trpezoidl method severl times. In the first time, the number of subintervls is n nd in ech clcultion tht follows the number of subintervls is doubled. 9
Richrdson s extrpoltion formul, is used for obtining improved estimtes for the vlue of the integrl from the vlues listed in the first column nd the process is repeted in the third nd the rest of the columns To pply Romberg integrtion use the following steps 1. Using the composite trpezoidl method find n estimte of I(f) using n, 1 n, n, 3 n,... intervls. These estimtes re lbeled I i,j, where j is the column number nd i is the row number, of squre mtric or dimension k k I i,j = (j) I i+1,j I i,j (j) 1 10