Part 5 Chapter 8 Numerical Integration of Functions Prof. Hae-Jin Choi hjchoi@cau.ac.kr Numerical Methos 00-
Chapter Objectives l Unerstaning how Richarson extrapolation provies a means to create a more accurate integral estimate by combining two less accurate estimates. l Unerstaning how Gauss quarature provies superior integral estimates by picking optimal abscissas at which to evaluate the function. l Knowing how to use MATLAB s built-in functions qua an qual to integrate functions. Numerical Methos 00-
Richarson Extrapolation(/ l Romberg Integration : A technique that is esigne to attain efficient numerical integrals of function l Richarson Extrapolation - Methos use two estimates of an integral to compute more accurate approximation. l Estimate an the error of the composite trapezoial rule I I( h + E( h l Two separate estimates using ifferent step size I h + E( h I( h + E( ( h l Error of composite trapezoial rule b - a E @ - h f Numerical Methos 00-
Richarson Extrapolation(/ l Ratio of the two errors E( h h æ @ h ö or E( h @ E( h E( h h ç è h ø æ h ö I( h - I( \ I( h + E( h ç I( h + E( h or E( h h - ( h è ø / h l If two O(h estimates I(h an I(h are calculate for an integral using step sizes of h an h, respectively, an improve O(h 4 estimate may be forme using: I I( h + E( h I I h + [ I( h - I( ] l For the special case where the interval is halve (h h /, this becomes: ( h ( h / h - I 4 I(h - I(h h Numerical Methos 00-4
Example 8. l Use Richarson extrapolation to evaluate the integral of the following function from a 0 to b 0.8. Exact solution is.6405. f ( x 0. +.5x - 00x + 675x - 900x + 400x 4 5 Results of single an composite integral using the trapezoial rule For n an Numerical Methos 00- I Segment n Step size h Integral e t 4 4 (.0688-0.8 0.4 0. (0.78.67467 E t.6405-.674670.7067 (e t 6.6% For n an 4 I 4 (.4848-5 0.78.0688.4848 (.0688.6467 89.5% 4.9% 9.5% E t.6405-.6467 0.07067 (e t.0%
Richarson Extrapolation(/ l For the cases where there are two O(h 4 estimates an the interval is halve (h m h l /, an improve O(h 6 estimate may be forme using: I 6 5 I m - 5 I l l For the cases where there are two O(h 6 estimates an the interval is halve (h m h l /, an improve O(h 8 estimate may be forme using: I 64 6 I m - 6 I l Numerical Methos 00-6 Where, I m more accurate estimate less accurate estimate I l
Example 8. l Q. In Ex. 8. we use Richarson extrapolation to compute two integral estimate of O(h4. To combine these two estimates to compute the integral with O(h6. Sol. I I 4 4 (.0688 - (.4848 - (0.78.67467 (.0688.6467 I 6 5 (.6467-5 (.67467.6405 à Which is the exact value of the integral. Numerical Methos 00-7
The Romberg Integration Algorithm l Note that the weighting factors for the Richarson extrapolation a up to an that as accuracy increases, the approximation using the smaller step size is given greater weight. l In general, I j,k 4 k- I j+,k- - I j,k- 4 k- - - I j+,k- an I j,k- : the more an less accurate integrals - I j,k : the new approximation. - k : the level of integration (k: original trapezoial rule, k: O(h4 estimates, k: O(h6 estimates - j is use to etermine which approximation is more accurate. 4I, - I, 4 I, I( h - I( h Numerical Methos 00-8
Romberg Algorithm Iterations l The chart below shows the process by which lower level integrations are combine to prouce more accurate estimates: Numerical Methos 00-9
MATLAB Coe for Romberg Numerical Methos 00-0
Gauss Quarature l Gauss quarature escribes a class of techniques for evaluating the area uner a straight line by joining any two points on a curve rather than simply choosing the enpoints. l The key is to choose the line that balances the positive an negative errors. I @ ( b - a f ( a + f ( b l The particular Gauss quarature formulas escribe in this section are calle Gauss- Legenre formulas Numerical Methos 00-
Gauss-Legenre Formulas l The metho of unetermine coefficients offers a thir approach (Gauss Quarature. I @ c0 f ( a + c f ( b l The trapezoial rule yiel exact results when the function being integrate is a constant or a straight line. Two simple equations are y an yx. c ( b + ò - a / 0 c -( b-a / c c b - a 0 + x b - a b - a - c0 + c b - a b - a - c + c Numerical Methos 00-0 ( b ò - a / -( b-a / 0 xx I b - a f ( a + b - a f ( b Equivalent to the trapezoial rule
Numerical Methos 00- Two point Gauss-Legenre I @ c0 f ( x0 + c f ( x Formulas x 0 an x are not fixe at the en points à four unknowns à four equations are require. It fits the integral of these functions y constant, y x, y x, y x 0 0 0 ( ( c + c ò x c x + c x 0 - ò xx - c0 x0 + cx ò x x ( c0 x0 + cx 0 - ò x x (4 - x x x - x ( Q x ¹ x c 0 0 0 0 c From ( & (4 (5 From (,(5,( From ( x0 - -0.57750K x 0.57750K - I f ( + f (
Two point Gauss-Legenre Numerical Methos 00-4 Formulas l The integration limits of previous two point Gauss-Legenre Formular are from - to. l A simple change of variable can be use to translate other limits of integration. x a ( x + a Lower limit x a à x Upper limit x b à x x a 0 0 b + a ( b + a + ( b - a x a a ( + a 0 - b a ( + a a x 0 b - a x b - a
Example 8. l Use two point Gauss-Legenre formula to evaluate the integral of the following function from x 0 an 0.8. The exact value is.6405. 4 5 f ( x 0. + 5x - 00x + 675x - 900x + 400x -Perform a change of variable so that the limits are from - to. x 0.4 + 0. 4x x 0. 4x ò 0.8 0 (0. + ò - [0. + 5x - 00x 5(0.4 + 0.4x - 900(0.4 + 0.4x + 675x 4-900x - 00(0.4 + 0.4x + 400(0.4 + 0.4x 4 + 400x 5 5 x + 675(0.4 + ]0.4x 0.4x ( f x x x - / f ( x - / 0.5674 Numerical Methos 00- / f ( x /.0587 5 I f ( x - / + f ( x /.8578
Numerical Methos 00- Higher-Point Formula I @ c 0 f ( x 0 + c f ( x +L+ c n- f x n- 6 ( <Weighting factors an functions use in Gauss-Legenre formulas> Points 4 5 6 Weighting factors c 0.0000000 c.0000000 c 0 0.5555556 c 0.8888889 c 0.5555556 c 0 0.478548 c 0.6545 c 0.6545 c 0.478548 c 0 0.6969 c 0.478687 c 0.5688889 c 0.478687 c 4 0.6969 c 0 0.745 c 0.60766 c 0.46799 c 0.46799 c 4 0.60766 c 5 0.745 Function arguments x 0 0.5775069 x 0.5775069 x 0 0.774596669 x 0.0 x 0.774596669 x 0 0.866 x 0.998044 x 0.998044 x 0.866 x 0 0.90679846 x 0.584690 x 0.0 x 0.584690 x 4 0.90679846 x 0 0.946954 x 0.660986 x 0.86986 x 0.86986 x 4 0.660986 x 5 0.946954 Truncation errors @ f (4 (x @ f (6 (x @ f (8 (x @ f (0 (x @ f ( (x
Example 8.4 l Q. Use the three point Gauss-Legenre formula to estimate the integral for the same function as in Ex. 8.. The exact value is.6405. 4 5 f ( x 0. + 5x - 00x + 675x - 900x + 400x I 0.5555556 f (-0.7745967 + 0.8888889 f (0 + 0.5555556 f (0.7745967 I 0.80 + 0.87444 + 0.4859876.6405 Because Gauss quarature requires function evaluations at nonuniformly space points within the integration interval, it is not appropriate for cases where the function is unknown. ànot suite for engineering problems that eal with tabulate ata. Where the function is known, its efficiency can have avantages. Numerical Methos 00-7
Aaptive Quarature l Methos such as Simpson s / rule has a isavantage in that it uses equally space points - if a function has regions of abrupt changes, small steps must be use over the entire omain to achieve a certain accuracy. l Aaptive quarature methos for integrating functions automatically ajust the step size so that small steps are taken in regions of sharp variations an larger steps are taken where the function changes graually. Numerical Methos 00-8
Aaptive Quarature in MATLAB MATLAB has two built-in functions for implementing aaptive quarature: qua: uses aaptive Simpson quarature; possibly more efficient for low accuracies or nonsmooth functions qual: uses Lobatto quarature; possibly more efficient for high accuracies an smooth functions q qua(fun, a, b, tol, trace, p, p, fun : function to be integrates a, b: integration bouns tol: esire absolute tolerance (efault: 0-6 trace: flag to isplay etails or not p, p, : extra parameters for fun qual has the same arguments Numerical Methos 00-9