
ECE 3040 Lecture 20: Numerical Integration II © Prof. Mohamad Hassoun This lecture covers the following topics: Introduction Richardson extrapolation & Romberg integration Gauss quadrature*: Two-point Gauss-Legendre formula Adaptive quadrature Matlab built-in numerical integration function integral Matlab polynomial and symbolic integration: polyint and int Taylor series-based integration Multiple integrals: integral2 & integral3 Monte Carlo integration * Numerical integration is sometimes referred to as quadrature. This is an old term that originally meant constructing a square that has the same area as a circle. Today, the term quadrature refers to numerical integration. Introduction In the previous lecture, the integration formulas could be applied to a table of values representing an unknown function or to a known function. For tabulated data, we are limited by the number of and the spacing between the points that are available. On the other hand, if the analytical form of the function is available, then we can generate as many values of the function as is required to improve the accuracy of numerical integration. This lecture capitalizes on the ability to generate function values to develop efficient techniques for numerical integration. Three such techniques are presented: Romberg integration, Gauss quadrature and adaptive quadrature. High-efficiency built-in Matlab numerical integration functions (integral, integral2 and integral3) are presented. Integration of polynomials and Matlab symbolic integration are discussed. Also, Taylor series-based integration is presented. This lecture extends the results of the previous lecture to numeric multiple integration. For example, the midpoint, trapezoidal or Simpson’s 1/3 method would be applied in the first dimension, with the values in the second dimension held constant. Then, the method would be applied to integrate the resulting numerical data as if it was one dimensional. The lecture concludes with the Monte Carlo integration method. Richardson Extrapolation & Romberg Integration Richardson extrapolation is a technique which uses two numerical estimates of an integral to compute a third, more accurate approximation. Such extrapolation can be employed with any of the integration formulas form Lecture 19. In the following, Richardson extrapolation is developed in the context of the trapezoidal rule integration. Recall that the trapezoidal rule with step size ℎ, has a truncation error 1 퐸 (ℎ) ≅ − ℎ2 [푓′(푏) − 푓′(푎)] (1) 푡 12 If we refer to the integral estimate as 퐼(ℎ) and the exact value of the integral as I, then we may write 퐼 = 퐼(ℎ) + 퐸푡(ℎ) Let us make two estimates for I using two different step sizes, ℎ1 and ℎ2, with ℎ2 < ℎ1. Then, we can relate the two estimates by 퐼(ℎ1) + 퐸푡(ℎ1) = 퐼(ℎ2) + 퐸푡(ℎ2) (2) The ratio of the truncation errors can be easily determined, and may be expressed as [employing Eqn. (1)] 퐸 (ℎ ) ℎ 2 푡 1 ≅ ( 1) 퐸푡(ℎ2) ℎ2 Solving for 퐸푡(ℎ1) gives 2 ℎ1 퐸푡(ℎ1) ≅ 퐸푡(ℎ2) ( ) (3) ℎ2 Now, substitute this result in Eqn. (2), 2 ℎ1 퐼(ℎ1) + 퐸푡(ℎ2) ( ) ≅ 퐼(ℎ2) + 퐸푡(ℎ2) ℎ2 and solve for 퐸푡(ℎ2) to obtain, 퐼(ℎ1) − 퐼(ℎ2) 퐸푡(ℎ2) ≅ ℎ 2 1 − ( 1) ℎ2 Thus we have developed an estimate of the truncation error with the smaller step size, ℎ2, in terms of the integral estimates and their step sizes. This estimate can then be substituted into 퐼 = 퐼(ℎ2) + 퐸푡(ℎ2) to yield an improved estimate of the integral, 1 퐼 ≅ 퐼(ℎ2) + [퐼(ℎ1) − 퐼(ℎ2)] ℎ 2 1 − ( 1) ℎ2 It has been shown that the error of this estimate is 푂(ℎ4). Thus, we have combined two trapezoidal rule estimates of 푂(ℎ2) to yield a significantly improved estimate ℎ of 푂(ℎ4). For the special case ℎ = 1 this equation becomes 2 2 Richardson extrapolation can be thought of as a weighted average of the approximations (note that the weight coefficients 4/3 and −1/3 add up to one). The following example illustrates the application of this method. Your turn: Show that Richardson extrapolation for Simpson’s 1/3 rule with ℎ2 = ℎ1 is given by 2 16 1 퐼 ≅ 퐼(ℎ ) − 퐼(ℎ ) 15 2 15 1 1 (Recall that Simpson’s rule has 퐸 (ℎ) ≅ − ℎ4 [푓′′′(푏) − 푓′′′(푎)]) 푡 180 Example. Use Richardson extrapolation to improve the trapezoidal rule evaluation of the following integral and compute the absolute relative true error (employ 푛 = 4, 8, 16). 4 퐼 = ∫ [10 − 푥3(푥 − 1)(푥 − 2)(푥 − 3)(푥 − 4)]푑푥 0 The exact value of the integral is 64.3810, computed as follows (recall Lecture 7 and refer to the section on polyint later in this lecture), The evaluations of the integral using the trapezoidal rule (using function int_trapz) are tabulated, along with the corresponding absolute relative true error 휀푡, in the 푏−푎 4 following table. [Recall that, ℎ = = ] 푛 푛 Segments ℎ 퐼(ℎ) 휀푡 4 1 40 37.9% 8 0.5 56.8750 11.7% 16 0.25 62.4121 3.1% Combining the estimates for the 4 and 8 segments using Richardson extrapolation yields 4 1 퐼 = (56.8750) − (40) = 62.5000 (휀 = 2.9%) 푙 3 3 푡 Similarly, combining the estimates for the 8 and 16 segments, yields 4 1 퐼 = (62.4121) − (56.8750) = 64.2578 (휀 = 0.19%) 푚 3 3 푡 The subscripts ‘푙’ and ‘푚’ signify the less accurate and more accurate integrals, respectively. The accuracy of 퐼푚 should be comparable to that obtained using Simpson’s 1/3 rule with 푛 = 16 (that would be 퐼푆 = 64.2578 @ 휀푡 = 0.19%), which confirms the 푂(ℎ4) convergence of the hybrid trapezoidal/Richardson extrapolation integration method. In fact, 퐼푚 = 퐼푠 which is proved formally in the next section. The integral value of 퐼푚 = 64.2578 could have been obtained using basic trapezoidal rule integration with an approximate step-size ℎ given by the solution of the following theoretical equation 1 1 퐸 = 64.381 − 64.2578 ≅ − ℎ2[푓′(4) − 푓′(0)] = − ℎ2(−384) = 32ℎ2 푡 12 12 4−0 Solving, we obtain ℎ ≅ 0.062. This value requires 푛 = = 65 segments. On 0.062 the other hand, employing Richardson interpolation is more efficient than a single application of the trapezoidal rule, because it only required 8 + 16 = 24 segments. The above method to improve the accuracy of the trapezoidal rule is a subset of a more general method for combining integrals to generate improved estimates, known as Romberg integration. In fact, the two 푂(ℎ4) improved integrals with values 퐼푙 = 62.5000 and 퐼푚 = 64.2578 can be combined to yield an even better value with 푂(ℎ6) accuracy. Here, the second-level Richardson extrapolation equation used to achieve the 푂(ℎ6) accuracy is 16 1 퐼 ≅ 퐼 − 퐼 15 푚 15 푙 4 where 퐼푚 and 퐼푙 are the more and less accurate 푂(ℎ ) estimates, respectively. So, for the above example, applying the second-level Richardson extrapolation leads to the improved accuracy value of the integral, 16 1 퐼 ≅ (64.2578) − (62.5000) = 64.3750 (휀 = 0.009%) 15 15 푡 Similarly, according to the Romberg integration technique, two 푂(ℎ6) results 8 (퐼푚, 퐼푙) can be combined to compute an estimate that is 푂(ℎ ) using the formula 64 1 퐼 ≅ 퐼 − 퐼 63 푚 63 푙 The Romberg formulas can be conveniently expressed as follows, Your turn: Employ Romberg integration and the above table in order to arrive at a 푂(ℎ8) solution for the above example. Do you expect the solution to be exact? Explain. Also, determine the number of segments required by the standard trapezoidal rule to achieve such accuracy. Richardson Extrapolation of the Trapezoidal Rule Leads to Simpson’s Rule Let us consider the integral 2푎 퐼 = ∫ 푓(푥)푑푥 푎 2푎−푎 The one segment (ℎ = = 푎) applications of the trapezoidal rule gives the 1 1 approximation 푎 퐼(ℎ ) = (푓(푎) + 푓(2푎)) 1 2 2푎−푎 The two segment (ℎ = = 푎/2) applications of the trapezoidal rule gives the 2 2 approximation 푎 푎 푎 푎 푎 푎 푎 푎 퐼(ℎ ) = (푓(푎) + 푓 (푎 + )) + (푓 (푎 + ) + 푓(2푎)) = 푓(푎) + 푓 (푎 + ) + 푓(2푎) 2 4 2 4 2 4 2 2 4 Applying Richardson extrapolation to the above estimates leads to 4 1 4 푎 푎 푎 푎 1 푎 푎 퐼 = 퐼(ℎ ) − 퐼(ℎ ) = ( 푓(푎) + 푓 (푎 + ) + 푓(2푎)) − ( 푓(푎) + 푓(2푎)) 푅 3 2 3 1 3 4 2 2 4 3 2 2 푎 푎 2푎 푎 푎 ( ) 푎 = 푓(푎) + 푓 (푎 + ) + 푓(2푎) = 2 (푓(푎) + 4푓 (푎 + ) + 푓(2푎)) 6 3 2 6 3 2 1 = ℎ (푓(푎) + 4푓(푎 + ℎ ) + 푓(푎 + 2ℎ )) 3 2 2 2 The last expression is identical to one (three-point/two-segment) approximation, 퐼푠, 푎 of Simpson’s 1/3 rule with integration step, ℎ = . Therefore, we have just proved 2 that Richardson extrapolation applied to the trapezoidal rule leads to Simpson’s 1/3 rule. Your turn: Show that the application of Richardson extrapolation to the 푂(ℎ4) Simpson 1/3 rule leads to the 푂(ℎ6) Boole’s rule (refer to Lecture 19 for the formulas for those rules). Your turn: Derive the two-segment integration rule that results from an application of Richardson extrapolation to the simple integration rule with 퐼(ℎ1) = 푎푓(푎) and 푎 푎 푎 2푎 퐼(ℎ ) = 푓(푎) + 푓 (푎 + ) for approximating ∫ 푓(푥)푑푥. Compare the absolute 2 2 2 2 푎 relative error of the resulting rule to that of the two-segment trapezoidal rule for the following test integral and its associated true value, 2 푥3 퐼 = ∫ 푥 푑푥 = 0.9515 1 푒 − 1 Gauss Quadrature: Two-Point Gauss-Legendre Formula 푏 ( ) The trapezoidal rule approximates the integral ∫푎 푓 푥 푑푥 as the area under the straight line connecting the function values at the ends of the integration segment [푎 푏], as shown in the following figure.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages25 Page
-
File Size-