CE 05 - Lecture 5 LECTURE 5 UMERICAL ITEGRATIO COTIUED Simpson s / Rule Simpson s / rule assumes equispaced data/interpolation/integration points Te integration rule is based on approximating fx using Lagrange quadratic (second degree) interpolation. Te sub-interval is defined as [x o,x ] and te integration point to integration point x spacing equals x o --------------- 79 f 0 f(x) f g(x) f x 0 x x x 0 0 x x coordinate sift p. 5.
CE 05 - Lecture 5 Lagrange quadratic interpolation over te sub-interval: gx f o V o x + f V x + f V x were V o x x x x x ----------------------------------------- x o x x o x V o x x x + ----------------------------------- V x x x o x x ----------------------------------------- x x o x x V x 4x x ----------------------- V x x x o x x ----------------------------------------- x x o x x V x x x ---------------- p. 5.
CE 05 - Lecture 5 Integration rule is obtained by integrating gx I x x fx I gxdx + E x o x o x x I f ----------------------------------- x + o f 4x ----------------------- x f x + + ---------------- x d x + E x o 0 I x -------- f x o ---- ----------- + x f 4x x ----------- ------- x + + f ---- ---- x 0 + E I -------- f o 8---- ----------- + 4 0 f 8 6 ----- 8 + + f -------- -------- 4 + E Simpson s / Rule I -- f o + 4f + f + E p. 5.
CE 05 - Lecture 5 Evaluation of te Error for Simpson s / Rule Error is defined as: E I -- f o + 4f + f E 0 fxdx -- f o + 4f + f We develop Taylor series expansions for fx, f o, f and f about x fx f x f -- x f -- x 6 f + + + + ----- x 4 4 f 4 + Ox 5 f o f f f f + -- f ---- 6 f + 4 ----- 4 f4 + O 5 f f f -- f ---- 6 f + + + + 4 ----- 4 f4 + O 5 p. 5.4
CE 05 - Lecture 5 Substituting into te expression for E E f x f -- x f -- x 6 f + + + + ----- x 4 4 f 4 + Ox 5 dx 0 -- f f + -- f ---- 6 f + ----- 4 4 f 4 + O 5 + 4f + f + f + -- f ---- 6 f + + 4 ----- 4 f4 + O 5 E f -- f -- + f 6 + + + ----- 4 4 f 4 + -------- 5 + 5 f 0 4 + O 6 -- 6f f + + ----- 4f4 + O 5 p. 5.5
CE 05 - Lecture 5 E f -- 6 ---- f 5 + + ----- ----- 5 f 4 + 60 6 O 6 Error for Simpson s / Rule E 90 ----- 5 f 4 Tis is te error for integration over one sub-interval of widt! Fift order accurate. Simpson s / Rule is exact for any cubic polynomial function We note tat E can also be derived by Estimating te error for Lagrange quadratic interpolation, series form ex fx gx, in Integrating e(x) over te integration interval x o x E x x o 0 exdx p. 5.6
CE 05 - Lecture 5 Extended Simpson s / Rule Simply add up integrated values obtained using Simpson s / rule over eac subinterval. 80 f(x) f 0 f f f f 4 f f(x) x a b subint. subint. Sub-interval size umber of sub-intervals --- Sub-interval widt is wile te integration point to integration point spacing is b a equal to ----------- p. 5.7
CE 05 - Lecture 5 Again we integrate over points (te same as extended trapezoidal rule). Terefore I b a fxdx I -- f o + 4f + f + f + 4f + f 4 + f 4 + 4f 5 + f 6 + + f 4 + 4f + f + f + 4f + f + E a b I -- f + o 4f + f + 4f + f + 4 4f + 5 + f + 4f + f E + ab In general we can write I -- fa + fb + 4 fa + i + fa + i + E ab i i p. 5.8
CE 05 - Lecture 5 ote tat te total number of integration points + must be odd and terefore must be even! Te error term is also summed over te sub-intervals and eac sub-interval term is evaluated at te mid node of te sub-interval. --- - 5 E ab i i ----- f 4 90 E a b - 5 --- ----- 90 --- --- f 4 i i E a b - 5 ----- 90 --- f 4 were f 4 average of te 4t derivative over eac sub-interval in te interval a b. p. 5.9
CE 05 - Lecture 5 However we wis dependence on error to be expressed in terms of, not in terms of te number of integration points. oting tat for te interval a b b a ----------- b a ----------- Terefore E ab - ----- 5 b a ----------- 90 -- f 4 E ab - 4 -------- b af 80 4 Overall te error is 4t order p. 5.0
CE 05 - Lecture 5 ewton Cotes Closed Formulae Derived by integrating Lagrange approximating polynomials (or equivalently ewton Interpolating formulae) using equispaced integration points (interpolating points, nodes, etc.) over te sub-interval defined by te interpolating data points 8 f 0 g(x) f f f x s x 0 x x x E x Te general form of ewton-cotes closed formulae: x E fx dx w o f o + w f + w f + + w f + E x S were f i x x o fx i x i x S + i ---------------- p. 5.
CE 05 - Lecture 5 Closed formulae: Te sub-interval is closed by te first and last integration points. w i, i 0 E ote Trapezoidal Rule -- ----- f 4 -- ----- 90 5 f 4 -- ----- 8 80 5 f 4 Simpson s -- Rule Simpson s -- Rule 8 4 7 7 ----- 45 8 -------- 945 7 f 6 0 5 6067 0600-4855 - 0.004 Round off error tends to ----------------- f 9976 7400-60550 4768 become a serious -60550 7400-4855 problem! 0600 6067 p. 5.
CE 05 - Lecture 5 otes All tese formulae integrate over one sub-interval only. Tey can be extended over ab simply by summing up integrals over eac sub-interval. In addition te error is summed resulting in one less order of accuracy tan te error over te individual sub-interval! Accuracy for Simpson s -- rule is very similar to accuracy of Simpson s -- rule. 8 In general eac formula will be exact for polynomials of one degree less tan te order of te derivatives in te error terms. gx E Exact for linear linear f quadratic cubic f 4 cubic cubic f 4 4 quartic quintic f 6 p. 5.
CE 05 - Lecture 5 It appears tat for even, te integration is exact for polynomials one degree greater tan te interpolation function. For Simpson s / Rule: 8 It turns out tat if fx is a cubic and gx is quadratic, E xo x E x x E[x 0,x ] f(x) f 0 f E[x,x ] f g(x) x 0 x x Te errors cancel over te interval due to te location of point! We can actually improve te accuracy of integration formulae by locating integration points in special locations! We do not experience any improvement in accuracy for odd. x p. 5.4
CE 05 - Lecture 5 ewton-cotes Open Formulae Derived by integrating Lagrange approximating formulae (or equivalently ewton Interpolating formulae) using equispaced data points/nodes/integration points over te sub-interval defined by te interpolating data points and extended to te left and rigt by. 8 f 0 f f g(x) f(x) f x s x 0 x x x x E x region of extrapolation region of extrapolation ote tat x S x o x E x + and x x o ---------------- p. 5.5
CE 05 - Lecture 5 ote tat gx does not generally pass troug fx S or troug fx E ewton Cotes open formula: x E fx dx w 0 f 0 + w f + + w f + E x S w i i 0 E / 4/ - 5/4 Error compared to closed interval Interval size compared to closed interval -- 4 f 8 ----- 90 5 f 4 8 95 -------- 44 5 f 4 8.7 p. 5.6
CE 05 - Lecture 5 otes Eac formula and error is for one sub-interval wit + data/node/integration points. We can extend te interval to ab by summing integrals and errors (error increases by one order). Sub-interval errors are greater tan closed formulae since sub-interval is larger te error in te interpolation functions tended to be greater near te ends and especially outside of te interpolating region! Higer order formulae involve large coefficients wit +/- signs. Tis leads to roundoff problems. Open formulae can be used wen functional values are not available at te integrating limits. p. 5.7