Numerical Integration Formulas

numerical differentiation and integration formulas, numerical integration equation of motion and numerical integration quadrature formulas pdf
GregDeamons Profile Pic
GregDeamons,New Zealand,Professional
Published Date:03-08-2017
Your Website URL(Optional)
Comment
cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 462 19 Numerical Integration Formulas CHAPTER OBJECTIVES The primary objective of this chapter is to introduce you to numerical integration. Specific objectives and topics covered are • Recognizing that Newton-Cotes integration formulas are based on the strategy of replacing a complicated function or tabulated data with a polynomial that is easy to integrate. • Knowing how to implement the following single application Newton-Cotes formulas: Trapezoidal rule Simpson’s 1/3 rule Simpson’s 3/8 rule • Knowing how to implement the following composite Newton-Cotes formulas: Trapezoidal rule Simpson’s 1/3 rule • Recognizing that even-segment–odd-point formulas like Simpson’s 1/3 rule achieve higher than expected accuracy. • Knowing how to use the trapezoidal rule to integrate unequally spaced data. • Understanding the difference between open and closed integration formulas. YOU’VE GOT A PROBLEM ecall that the velocity of a free-falling bungee jumper as a function of time can be computed as R     gm gc d v(t) = tanh t (19.1) c m d 462cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 463 19.1 INTRODUCTION AND BACKGROUND 463 Suppose that we would like to know the vertical distance z the jumper has fallen after a certain time t. This distance can be evaluated by integration:  t z(t) = v(t) dt (19.2) 0 Substituting Eq. (19.1) into Eq. (19.2) gives      t gm gc d z(t) = tanh t dt (19.3) c m 0 d Thus, integration provides the means to determine the distance from the velocity. Calculus can be used to solve Eq. (19.3) for     m gc d z(t) = ln cosh t (19.4) c m d Although a closed form solution can be developed for this case, there are other func- tions that cannot be integrated analytically. Further, suppose that there was some way to measure the jumper’s velocity at various times during the fall. These velocities along with their associated times could be assembled as a table of discrete values. In this situation, it would also be possible to integrate the discrete data to determine the distance. In both these instances, numerical integration methods are available to obtain solutions. Chapters 19 and 20 will introduce you to some of these methods. 19.1 INTRODUCTION AND BACKGROUND 19.1.1 What Is Integration? According to the dictionary definition, to integrate means “to bring together, as parts, into a whole; to unite; to indicate the total amount. . . .” Mathematically, definite integration is represented by  b I = f (x) dx (19.5) a which stands for the integral of the function f (x) with respect to the independent variable x, evaluated between the limits x = a to x = b. As suggested by the dictionary definition, the “meaning” of Eq. (19.5) is the total  value, or summation, of f (x)dx over the range x = a to b. In fact, the symbol is actu- ally a stylized capital S that is intended to signify the close connection between integration and summation. Figure 19.1 represents a graphical manifestation of the concept. For functions lying above the x axis, the integral expressed by Eq. (19.5) corresponds to the area under the curve of f (x) between x = a and b. Numerical integration is sometimes referred to as quadrature. This is an archaic term that originally meant the construction of a square having the same area as some curvilinear figure. Today, the term quadrature is generally taken to be synonymous with numerical definite integration. cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 464 464 NUMERICAL INTEGRATION FORMULAS f (x) a x b FIGURE 19.1 Graphical representation of the integral of f (x) between the limits x = a to b. The integral is equivalent to the area under the curve. 19.1.2 Integration in Engineering and Science Integration has so many engineering and scientific applications that you were required to take integral calculus in your first year at college. Many specific examples of such appli- cations could be given in all fields of engineering and science. A number of examples re- late directly to the idea of the integral as the area under a curve. Figure 19.2 depicts a few cases where integration is used for this purpose. Other common applications relate to the analogy between integration and summation. For example, a common application is to determine the mean of a continuous function. Recall that the mean of n discrete data points can be calculated by Eq. (14.2). n y i i=1 Mean = (19.6) n where y are individual measurements. The determination of the mean of discrete points is i depicted in Fig. 19.3a. In contrast, suppose that y is a continuous function of an independent variable x, as depicted in Fig. 19.3b. For this case, there are an infinite number of values between a and b. Just as Eq. (19.6) can be applied to determine the mean of the discrete readings, you might also be interested in computing the mean or average of the continuous function y = f (x) for the interval from a to b. Integration is used for this purpose, as specified by  b f (x)dx a Mean = (19.7) b − a This formula has hundreds of engineering and scientific applications. For example, it is used to calculate the center of gravity of irregular objects in mechanical and civil engi- neering and to determine the root-mean-square current in electrical engineering.cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 465 19.1 INTRODUCTION AND BACKGROUND 465 (a)(b)(c) FIGURE 19.2 Examples of how integration is used to evaluate areas in engineering and scientific applications. (a) A surveyor might need to know the area of a field bounded by a meandering stream and two roads. (b) A hydrologist might need to know the cross-sectional area of a river. (c) A structural engineer might need to determine the net force due to a nonuniform wind blowing against the side of a skyscraper. y Mean i 04 1 2356 (a) y  f (x) Mean x a b (b) FIGURE 19.3 An illustration of the mean for (a) discrete and (b) continuous data. cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 466 466 NUMERICAL INTEGRATION FORMULAS Integrals are also employed by engineers and scientists to evaluate the total amount or quantity of a given physical variable. The integral may be evaluated over a line, an area, or a volume. For example, the total mass of chemical contained in a reactor is given as the product of the concentration of chemical and the reactor volume, or Mass = concentration × volume where concentration has units of mass per volume. However, suppose that concentration varies from location to location within the reactor. In this case, it is necessary to sum the products of local concentrations c and corresponding elemental volumes V : i i n Mass = c V i i i=1 where n is the number of discrete volumes. For the continuous case, where c(x, y, z) is a known function and x, y, and z are independent variables designating position in Cartesian coordinates, integration can be used for the same purpose:  Mass = c(x, y, z)dx dy dz or  Mass = c(V) dV V which is referred to as a volume integral. Notice the strong analogy between summation and integration. Similar examples could be given in other fields of engineering and science. For exam- ple, the total rate of energy transfer across a plane where the flux (in calories per square centimeter per second) is a function of position is given by  Flux = ux dA A which is referred to as an areal integral, where A = area. These are just a few of the applications of integration that you might face regularly in the pursuit of your profession. When the functions to be analyzed are simple, you will nor- mally choose to evaluate them analytically. However, it is often difficult or impossible when the function is complicated, as is typically the case in more realistic examples. In ad- dition, the underlying function is often unknown and defined only by measurement at dis- crete points. For both these cases, you must have the ability to obtain approximate values for integrals using numerical techniques as described next. 19.2 NEWTON-COTES FORMULAS The Newton-Cotes formulas are the most common numerical integration schemes. They are based on the strategy of replacing a complicated function or tabulated data with a poly- nomial that is easy to integrate:   b b ∼ I = f (x)dx = f (x)dx (19.8) n a acha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 467 19.2 NEWTON-COTES FORMULAS 467 where f (x) = a polynomial of the form n n−1 n f (x) = a + a x +···+ a x + a x (19.9) n 0 1 n−1 n where n is the order of the polynomial. For example, in Fig. 19.4a, a first-order polynomial (a straight line) is used as an approximation. In Fig. 19.4b, a parabola is employed for the same purpose. The integral can also be approximated using a series of polynomials applied piecewise to the function or data over segments of constant length. For example, in Fig. 19.5, three FIGURE 19.4 The approximation of an integral by the area under (a) a straight line and (b) a parabola. f (x) f (x) a x a x b b (a) (b) FIGURE 19.5 The approximation of an integral by the area under three straight-line segments. f (x) a x bcha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 468 468 NUMERICAL INTEGRATION FORMULAS f (x) f (x) a x a x b b (a) (b) FIGURE 19.6 The difference between (a) closed and (b) open integration formulas. straight-line segments are used to approximate the integral. Higher-order polynomials can be utilized for the same purpose. Closed and open forms of the Newton-Cotes formulas are available. The closed forms are those where the data points at the beginning and end of the limits of integration are known (Fig. 19.6a). The open forms have integration limits that extend beyond the range of the data (Fig. 19.6b). This chapter emphasizes the closed forms. However, material on open Newton-Cotes formulas is briefly introduced in Section 19.7. 19.3 THE TRAPEZOIDAL RULE The trapezoidal rule is the first of the Newton-Cotes closed integration formulas. It corre- sponds to the case where the polynomial in Eq. (19.8) is first-order:    b f (b) − f (a) I = f (a) + (x − a) dx (19.10) b − a a The result of the integration is f (a) + f (b) I = (b − a) (19.11) 2 which is called the trapezoidal rule. Geometrically, the trapezoidal rule is equivalent to approximating the area of the trapezoid under the straight line connecting f (a) and f (b) in Fig. 19.7. Recall from geom- etry that the formula for computing the area of a trapezoid is the height times the average of the bases. In our case, the concept is the same but the trapezoid is on its side. Therefore, the integral estimate can be represented as I = width × average height (19.12)cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 469 19.3 THE TRAPEZOIDAL RULE 469 f (x) f (b) f (a) a x b FIGURE 19.7 Graphical depiction of the trapezoidal rule. or I = (b − a) × average height (19.13) where, for the trapezoidal rule, the average height is the average of the function values at the end points, or f (a) + f (b)/2. All the Newton-Cotes closed formulas can be expressed in the general format of Eq. (19.13). That is, they differ only with respect to the formulation of the average height. 19.3.1 Error of the Trapezoidal Rule When we employ the integral under a straight-line segment to approximate the integral under a curve, we obviously can incur an error that may be substantial (Fig. 19.8). An esti- mate for the local truncation error of a single application of the trapezoidal rule is 1  3 E =− f (ξ)(b − a) (19.14) t 12 where ξ lies somewhere in the interval from a to b. Equation (19.14) indicates that if the function being integrated is linear, the trapezoidal rule will be exact because the second de- rivative of a straight line is zero. Otherwise, for functions with second- and higher-order derivatives (i.e., with curvature), some error can occur. EXAMPLE 19.1 Single Application of the Trapezoidal Rule Problem Statement. Use Eq. (19.11) to numerically integrate 2 3 4 5 f (x) = 0.2 + 25x − 200x + 675x − 900x + 400x from a = 0 to b = 0.8. Note that the exact value of the integral can be determined analyt- ically to be 1.640533.cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 470 470 NUMERICAL INTEGRATION FORMULAS f (x) 2.0 Error Integral estimate x 0 0.8 FIGURE 19.8 Graphical depiction of the use of a single application of the trapezoidal rule to approximate 2 3 4 5 the integral of f (x) = 0.2 + 25x − 200x + 675x − 900x + 400x from x = 0 to 0.8. Solution. The function values f (0) = 0.2 and f (0.8) = 0.232 can be substituted into Eq. (19.11) to yield 0.2 + 0.232 I = (0.8 − 0) = 0.1728 2 which represents an error of E = 1.640533 − 0.1728 = 1.467733, which corresponds to t a percent relative error of ε = 89.5%. The reason for this large error is evident from the t graphical depiction in Fig. 19.8. Notice that the area under the straight line neglects a sig- nificant portion of the integral lying above the line. In actual situations, we would have no foreknowledge of the true value. Therefore, an approximate error estimate is required. To obtain this estimate, the function’s second derivative over the interval can be computed by differentiating the original function twice to give  2 3 f (x)=−400 + 4,050x − 10,800x + 8,000x The average value of the second derivative can be computed as Eq. (19.7)  0.8 2 3 (−400 + 4,050x − 10,800x + 8,000x )dx  0 ¯ f (x) = =−60 0.8 − 0 which can be substituted into Eq. (19.14) to yield 1 3 E =− (−60)(0.8) = 2.56 a 12cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 471 19.3 THE TRAPEZOIDAL RULE 471 which is of the same order of magnitude and sign as the true error. A discrepancy does exist, however, because of the fact that for an interval of this size, the average second derivative  is not necessarily an accurate approximation of f (ξ). Thus, we denote that the error is approximate by using the notation E , rather than exact by using E . a t 19.3.2 The Composite Trapezoidal Rule One way to improve the accuracy of the trapezoidal rule is to divide the integration interval from a to b into a number of segments and apply the method to each segment (Fig. 19.9). The areas of individual segments can then be added to yield the integral for the entire interval. The resulting equations are called composite, or multiple-segment, integration formulas. Figure 19.9 shows the general format and nomenclature we will use to characterize composite integrals. There are n + 1 equally spaced base points (x , x , x ,..., x ). Con- 0 1 2 n sequently, there are n segments of equal width: (19.15) b − a h = n If a and b are designated as x and x , respectively, the total integral can be repre- 0 n sented as    x x x 1 2 n I = f (x)dx + f (x)dx +···+ f (x)dx x x x 0 1 n−1 FIGURE 19.9 Composite trapezoidal rule. f(x) x x x x x x 0 1 2 3 4 5 x  ax b  a  b 0 n h  ncha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 472 472 NUMERICAL INTEGRATION FORMULAS Substituting the trapezoidal rule for each integral yields f (x ) + f (x ) f (x ) + f (x ) f (x ) + f (x ) 0 1 1 2 n−1 n I = h + h +···+ h (19.16) 2 2 2 or, grouping terms: n−1 h I = f (x ) + 2 f (x ) + f (x ) (19.17) 0 i n 2 i=1 or, using Eq. (19.15) to express Eq. (19.17) in the general form of Eq. (19.13): n−1 f (x ) + 2 f (x ) + f (x ) 0 i n i=1 I = (b − a) (19.18)   2n   Width Average height Because the summation of the coefficients of f (x) in the numerator divided by 2n is equal to 1, the average height represents a weighted average of the function values. According to Eq. (19.18), the interior points are given twice the weight of the two end points f (x ) and 0 f (x ). n An error for the composite trapezoidal rule can be obtained by summing the individ- ual errors for each segment to give n 3 (b − a)  E =− f (ξ ) (19.19) t i 3 12n i=1  where f (ξ ) is the second derivative at a point ξ located in segment i. This result can be i i simplified by estimating the mean or average value of the second derivative for the entire interval as n  f (ξ ) i i=1  ¯ ∼ f = (19.20) n   ∼ ¯ f (ξ ) n f Therefore = and Eq. (19.19) can be rewritten as i 3 (b − a)  ¯ E =− f (19.21) a 2 12n Thus, if the number of segments is doubled, the truncation error will be quartered. Note that Eq. (19.21) is an approximate error because of the approximate nature of Eq. (19.20). EXAMPLE 19.2 Composite Application of the Trapezoidal Rule Problem Statement. Use the two-segment trapezoidal rule to estimate the integral of 2 3 4 5 f (x) = 0.2 + 25x − 200x + 675x − 900x + 400x from a = 0 to b = 0.8. Employ Eq. (19.21) to estimate the error. Recall that the exact value of the integral is 1.640533.cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 473 19.3 THE TRAPEZOIDAL RULE 473 Solution. For n = 2(h = 0.4): f (0) = 0.2 f (0.4) = 2.456 f (0.8) = 0.232 0.2 + 2(2.456) + 0.232 I = 0.8 = 1.0688 4 E = 1.640533 − 1.0688 = 0.57173 ε = 34.9% t t 3 0.8 E =− (−60) = 0.64 a 2 12(2) where −60 is the average second derivative determined previously in Example 19.1. The results of the previous example, along with three- through ten-segment applica- tions of the trapezoidal rule, are summarized in Table 19.1. Notice how the error decreases as the number of segments increases. However, also notice that the rate of decrease is grad- ual. This is because the error is inversely related to the square of n Eq. (19.21). Therefore, doubling the number of segments quarters the error. In subsequent sections we develop higher-order formulas that are more accurate and that converge more quickly on the true in- tegral as the segments are increased. However, before investigating these formulas, we will first discuss how MATLAB can be used to implement the trapezoidal rule. 19.3.3 MATLAB M-file: trap A simple algorithm to implement the composite trapezoidal rule can be written as in Fig. 19.10. The function to be integrated is passed into the M-file along with the limits of integration and the number of segments. A loop is then employed to generate the integral following Eq. (19.18). TABLE 19.1 Results for the composite trapezoidal rule to f (x) estimate the integral of = 0.2 + 25x − 2 3 4 5 200x + 675x − 900x + 400x from x = 0 to 0.8. The exact value is 1.640533. nh I ε (%) t 2 0.4 1.0688 34.9 3 0.2667 1.3695 16.5 4 0.2 1.4848 9.5 5 0.16 1.5399 6.1 6 0.1333 1.5703 4.3 7 0.1143 1.5887 3.2 8 0.1 1.6008 2.4 9 0.0889 1.6091 1.9 10 0.08 1.6150 1.6 cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 474 474 NUMERICAL INTEGRATION FORMULAS function I = trap(func,a,b,n,varargin) % trap: composite trapezoidal rule quadrature % I = trap(func,a,b,n,pl,p2,...): % composite trapezoidal rule % input: % func = name of function to be integrated % a, b = integration limits % n = number of segments (default = 100) % pl,p2,... = additional parameters used by func % output: % I = integral estimate if nargin3,error('at least 3 input arguments required'),end if (ba),error('upper bound must be greater than lower'),end if nargin4isempty(n),n=100;end x = a; h = (b - a)/n; s=func(a,varargin:); for i = 1 : n-1 x = x + h; s = s + 2func(x,varargin:); end s = s + func(b,varargin:); I = (b - a) s/(2n); FIGURE 19.10 M-file to implement the composite trapezoidal rule. An application of the M-file can be developed to determine the distance fallen by the free-falling bungee jumper in the first 3 s by evaluating the integral of Eq. (19.3). For 2 this example, assume the following parameter values: g = 9.81 m/s , m = 68.1kg, and c = 0.25 kg/m. Note that the exact value of the integral can be computed with Eq. (19.4) d as 41.94805. The function to be integrated can be developed as an M-file or with an anonymous function, v=(t) sqrt(9.8168.1/0.25)tanh(sqrt(9.810.25/68.1)t) v = (t) sqrt(9.8168.1/0.25)tanh(sqrt(9.810.25/68.1)t) First, let’s evaluate the integral with a crude five-segment approximation: format long trap(v,0,3,5) ans = 41.86992959072735cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 475 19.4 SIMPSON’S RULES 475 As would be expected, this result has a relatively high true error of 18.6%. To obtain a more accurate result, we can use a very fine approximation based on 10,000 segments: trap(v,0,3,10000) x = 41.94804999917528 which is very close to the true value. 19.4 SIMPSON’S RULES Aside from applying the trapezoidal rule with finer segmentation, another way to obtain a more accurate estimate of an integral is to use higher-order polynomials to connect the points. For example, if there is an extra point midway between f (a) and f (b), the three points can be connected with a parabola (Fig. 19.11a). If there are two points equally spaced between f (a) and f (b), the four points can be connected with a third-order poly- nomial (Fig. 19.11b). The formulas that result from taking the integrals under these poly- nomials are called Simpson’s rules. 19.4.1 Simpson’s 1/3 Rule Simpson’s 1/3 rule corresponds to the case where the polynomial in Eq. (19.8) is second- order:   x 2 (x − x )(x − x ) (x − x )(x − x ) 1 2 0 2 I = f (x ) + f (x ) 0 1 (x − x )(x − x ) (x − x )(x − x ) x 0 1 0 2 1 0 1 2 0  (x − x )(x − x ) 0 1 + f (x ) dx 2 (x − x )(x − x ) 2 0 2 1 FIGURE 19.11 (a) Graphical depiction of Simpson’s 1/3 rule: It consists of taking the area under a parabola connecting three points. (b) Graphical depiction of Simpson’s 3/8 rule: It consists of taking the area under a cubic equation connecting four points. f (x) f (x) x x (a) (b)cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 476 476 NUMERICAL INTEGRATION FORMULAS where a and b are designated as x and x , respectively. The result of the integration is 0 2 h I = f (x ) + 4 f (x ) + f (x ) (19.22) 0 1 2 3 where, for this case, h = (b − a)/2. This equation is known as Simpson’s 1/3 rule. The label “1/3” stems from the fact that h is divided by 3 in Eq. (19.22). Simpson’s 1/3 rule can also be expressed using the format of Eq. (19.13): f (x ) + 4 f (x ) + f (x ) 0 1 2 I = (b − a) (19.23) 6 where a = x , b = x , and x = the point midway between a and b, which is given by 0 2 1 (a + b)/2. Notice that, according to Eq. (19.23), the middle point is weighted by two- thirds and the two end points by one-sixth. It can be shown that a single-segment application of Simpson’s 1/3 rule has a trunca- tion error of 1 5 (4) E =− h f (ξ) t 90 or, because h = (b − a)/2: 5 (b − a) (4) E =− f (ξ) (19.24) t 2880 where ξ lies somewhere in the interval from a to b. Thus, Simpson’s 1/3 rule is more ac- curate than the trapezoidal rule. However, comparison with Eq. (19.14) indicates that it is more accurate than expected. Rather than being proportional to the third derivative, the error is proportional to the fourth derivative. Consequently, Simpson’s 1/3 rule is third- order accurate even though it is based on only three points. In other words, it yields exact results for cubic polynomials even though it is derived from a parabola EXAMPLE 19.3 Single Application of Simpson’s 1/3 Rule Problem Statement. Use Eq. (19.23) to integrate 2 3 4 5 f (x) = 0.2 + 25x − 200x + 675x − 900x + 400x from a = 0 to b = 0.8. Employ Eq. (19.24) to estimate the error. Recall that the exact in- tegral is 1.640533. Solution. n = 2(h = 0.4): f (0) = 0.2 f (0.4) = 2.456 f (0.8) = 0.232 0.2 + 4(2.456) + 0.232 I = 0.8 = 1.367467 6 E = 1.640533 − 1.367467 = 0.2730667 ε = 16.6% t tcha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 477 19.4 SIMPSON’S RULES 477 which is approximately five times more accurate than for a single application of the trape- zoidal rule (Example 19.1). The approximate error can be estimated as 5 0.8 E =− (−2400) = 0.2730667 a 2880 where −2400 is the average fourth derivative for the interval. As was the case in Exam- ple 19.1, the error is approximate (E ) because the average fourth derivative is generally a (4) not an exact estimate of f (ξ). However, because this case deals with a fifth-order poly- nomial, the result matches exactly. 19.4.2 The Composite Simpson’s 1/3 Rule Just as with the trapezoidal rule, Simpson’s rule can be improved by dividing the integra- tion interval into a number of segments of equal width (Fig. 19.12). The total integral can be represented as    x x x 2 4 n I = f (x)dx + f (x)dx +···+ f (x)dx (19.25) x x x 0 2 n−2 FIGURE 19.12 Composite Simpson’s 1/3 rule. The relative weights are depicted above the function values. Note that the method can be employed only if the number of segments is even. f(x) 141 141 141 141 141 2 4 4 2 1 4 2 1 4 4 2 a x bcha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 478 478 NUMERICAL INTEGRATION FORMULAS Substituting Simpson’s 1/3 rule for each integral yields f (x ) + 4 f (x ) + f (x ) f (x ) + 4 f (x ) + f (x ) 0 1 2 2 3 4 I = 2h + 2h 6 6 f (x ) + 4 f (x ) + f (x ) n−2 n−1 n +···+ 2h 6 or, grouping terms and using Eq. (19.15): n−1 n−2 f (x ) + 4 f (x ) + 2 f (x ) + f (x ) 0 i j n i=1,3,5 j=2,4,6 I = (b − a) (19.26) 3n Notice that, as illustrated in Fig. 19.12, an even number of segments must be utilized to implement the method. In addition, the coefficients “4” and “2” in Eq. (19.26) might seem peculiar at first glance. However, they follow naturally from Simpson’s 1/3 rule. As illustrated in Fig. 19.12, the odd points represent the middle term for each application and hence carry the weight of four from Eq. (19.23). The even points are common to adjacent applications and hence are counted twice. An error estimate for the composite Simpson’s rule is obtained in the same fashion as for the trapezoidal rule by summing the individual errors for the segments and averaging the derivative to yield 5 (b − a) (4) ¯ E =− f (19.27) a 4 180n (4) where f is the average fourth derivative for the interval. EXAMPLE 19.4 Composite Simpson’s 1/3 Rule Problem Statement. Use Eq. (19.26) with n = 4 to estimate the integral of 2 3 4 5 f (x) = 0.2 + 25x − 200x + 675x − 900x + 400x from a = 0 to b = 0.8. Employ Eq. (19.27) to estimate the error. Recall that the exact integral is 1.640533. Solution. n = 4(h = 0.2): f (0) = 0.2 f (0.2) = 1.288 f (0.4) = 2.456 f (0.6) = 3.464 f (0.8) = 0.232 From Eq. (19.26): 0.2 + 4(1.288 + 3.464) + 2(2.456) + 0.232 I = 0.8 = 1.623467 12 E = 1.640533 − 1.623467 = 0.017067 ε = 1.04% t tcha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 479 19.4 SIMPSON’S RULES 479 The estimated error (Eq. 19.27) is 5 (0.8) E =− (−2400) = 0.017067 a 4 180(4) which is exact (as was also the case for Example 19.3). As in Example 19.4, the composite version of Simpson’s 1/3 rule is considered supe- rior to the trapezoidal rule for most applications. However, as mentioned previously, it is limited to cases where the values are equispaced. Further, it is limited to situations where there are an even number of segments and an odd number of points. Consequently, as dis- cussed in Section 19.4.3, an odd-segment–even-point formula known as Simpson’s 3/8 rule can be used in conjunction with the 1/3 rule to permit evaluation of both even and odd numbers of equispaced segments. 19.4.3 Simpson’s 3/8 Rule In a similar manner to the derivation of the trapezoidal and Simpson’s 1/3 rule, a third- order Lagrange polynomial can be fit to four points and integrated to yield 3h I = f (x ) + 3 f (x ) + 3 f (x ) + f (x ) 0 1 2 3 8 where h = (b − a)/3. This equation is known as Simpsons 3/8 rule because h is multiplied by 3/8. It is the third Newton-Cotes closed integration formula. The 3/8 rule can also be expressed in the form of Eq. (19.13): f (x ) + 3 f (x ) + 3 f (x ) + f (x ) 0 1 2 3 I = (b − a) (19.28) 8 Thus, the two interior points are given weights of three-eighths, whereas the end points are weighted with one-eighth. Simpson’s 3/8 rule has an error of 3 5 (4) E =− h f (ξ) t 80 or, because h = (b − a)/3: 5 (b − a) (4) E =− f (ξ) (19.29) t 6480 Because the denominator of Eq. (19.29) is larger than for Eq. (19.24), the 3/8 rule is some- what more accurate than the 1/3 rule. Simpson’s 1/3 rule is usually the method of preference because it attains third-order accuracy with three points rather than the four points required for the 3/8 version. How- ever, the 3/8 rule has utility when the number of segments is odd. For instance, in Exam- ple 19.4 we used Simpson’s rule to integrate the function for four segments. Suppose that you desired an estimate for five segments. One option would be to use a composite version of the trapezoidal rule as was done in Example 19.2. This may not be advisable, however, because of the large truncation error associated with this method. An alternative would be to apply Simpson’s 1/3 rule to the first two segments and Simpson’s 3/8 rule to the lastcha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 480 480 NUMERICAL INTEGRATION FORMULAS f (x) 3 2 1 0 x 0 0.2 0.4 0.6 0.8 1/3 rule 3/8 rule FIGURE 19.13 Illustration of how Simpson’s 1/3 and 3/8 rules can be applied in tandem to handle multiple applications with odd numbers of intervals. three (Fig. 19.13). In this way, we could obtain an estimate with third-order accuracy across the entire interval. EXAMPLE 19.5 Simpson’s 3/8 Rule Problem Statement. (a) Use Simpson’s 3/8 rule to integrate 2 3 4 5 f (x) = 0.2 + 25x − 200x + 675x − 900x + 400x from a = 0 to b = 0.8. (b) Use it in conjunction with Simpson’s 1/3 rule to integrate the same function for five segments. Solution. (a) A single application of Simpson’s 3/8 rule requires four equally spaced points: f (0) = 0.2 f (0.2667) = 1.432724 f (0.5333) = 3.487177 f (0.8) = 0.232 Using Eq. (19.28): 0.2 + 3(1.432724 + 3.487177) + 0.232 I = 0.8 = 1.51970 8cha01102_ch19_459-496.qxd 12/17/10 8:20 AM Page 481 19.5 HIGHER-ORDER NEWTON-COTES FORMULAS 481 (b) The data needed for a five-segment application (h = 0.16) are f (0) = 0.2 f (0.16) = 1.296919 f (0.32) = 1.743393 f (0.48) = 3.186015 f (0.64) = 3.181929 f (0.80) = 0.232 The integral for the first two segments is obtained using Simpson’s 1/3 rule: 0.2 + 4(1.296919) + 1.743393 I = 0.32 = 0.3803237 6 For the last three segments, the 3/8 rule can be used to obtain 1.743393 + 3(3.186015 + 3.181929) + 0.232 I = 0.48 = 1.264754 8 The total integral is computed by summing the two results: I = 0.3803237 + 1.264754 = 1.645077 19.5 HIGHER-ORDER NEWTON-COTES FORMULAS As noted previously, the trapezoidal rule and both of Simpson’s rules are members of a family of integrating equations known as the Newton-Cotes closed integration formulas. Some of the formulas are summarized in Table 19.2 along with their truncation-error estimates. Notice that, as was the case with Simpson’s 1/3 and 3/8 rules, the five- and six-point formulas have the same order error. This general characteristic holds for the higher-point formulas and leads to the result that the even-segment–odd-point formulas (e.g., 1/3 rule and Boole’s rule) are usually the methods of preference. TABLE 19.2 Newton-Cotes closed integration formulas. The formulas are presented in the format of Eq. (19.13) so that the weighting of the data points to estimate the average height is apparent. The step size is given by h = (b − a)/n. Segments (n) Points Name Formula Truncation Error f (x ) + f (x ) 0 1 3  1 2 Trapezoidal rule (b − a) −(1/12)h f (ξ) 2 f (x ) + 4 f (x ) + f (x ) 0 1 2 5 (4) (b − a) 2 3 Simpson’s 1/3 rule −(1/90)h f (ξ) 6 f (x ) + 3 f (x ) + 3 f (x ) + f (x ) 0 1 2 3 5 (4) 3 4 Simpson’s 3/8 rule (b − a) −(3/80)h f (ξ) 8 7 f (x ) + 32 f (x ) + 12 f (x ) + 32 f (x ) + 7 f (x ) 0 1 2 3 4 7 (6) (b − a) 4 5 Boole’s rule −(8/945)h f (ξ) 90 19 f (x ) + 75 f (x ) + 50 f (x ) + 50 f (x ) + 75 f (x ) + 19 f (x ) 0 1 2 3 4 5 7 (6) 56 (b − a) −(275/12,096)h f (ξ) 288

Advise: Why You Wasting Money in Costly SEO Tools, Use World's Best Free SEO Tool Ubersuggest.