Since fo, fi, and f2 are constants with respect to integration, the relations in(4.13) lead to C八)h≈后= )(x-x2) 1)( (4.15) da f2 2-x0)(2-x1 We introduce the change of variable a = ro ht with dx hdt to assist with the evaluation of the integrals in(4.15). The new limits of integration are from t=0 to t=2. qual spacing of the nodes ak =To+ kh leads to Tk-T,=(k-j)h and (t-k), which are used to simplify(4.15) and get f(x)dx≈fo r2h(t-1)h(t-2) (一h)(-2h) hdt +fi ht-0)h(t-2) (h)(-h) hdt (4.16 +m0 hdt (2-3+2)d-fh/(2-)2a/(2-t) h/t 3t2 =o/ih/43 h +f2 32 h2(3)-质b(3)+h2(3) o+4/f1+f2) and the proof is complete. We postpone a sample proof of Corollary 4.1 until Section Example 2.1. Consider the function f(a)=l+- sin(4.), the equally spaced spaced quadrature nodes o =0.0, 11=0.5, 2=1.0, 3=1.5, and 4= 2.0, and the corre- sponding function values fo=100000, f2=0. 72159, f3=0.93765, and f 4=1. 13390 Apply the various quadrature formulas(2.4)through(2.7)
Since f0, f1, and f2 are constants with respect to integration, the relations in (4.13) lead to Z x2 x0 f(x)dx ≈ f0 Z x2 x0 (x − x1)(x − x2) (x0 − x1)(x0 − x2) dx (4.15) +f1 Z x2 x0 (x − x0)(x − x2) (x1 − x0)(x1 − x2) dx + f2 Z x2 x0 (x − x0)(x − x1) (x2 − x0)(x2 − x1) dx We introduce the change of variable x = x0 + ht with dx = hdt to assist with the evaluation of the integrals in (4.15). The new limits of integration are from t = 0 to t = 2. The equal spacing of the nodes xk = x0 + kh leads to xk − xj = (k − j)h and x − xk = h(t − k), which are used to simplify (4.15) and get Z x2 x0 f(x)dx ≈ f0 Z 2 0 h(t − 1)h(t − 2) (−h)(−2h) hdt + f1 Z 2 0 h(t − 0)h(t − 2) (h)(−h) hdt (4.16) +f2 Z 2 0 h(t − 0)h(t − 1) (2h)(h) hdt = f0 h 2 Z 2 0 (t 2 − 3t + 2)dt − f1h Z 2 0 (t 2 − 2t)dt + f2 h 2 Z 2 0 (t 2 − t)dt = f0 h 2 à t 3 3 − 3t 2 2 + 2t ! ¯ ¯ ¯ t=2 t=0 − f1h à t 3 3 − t 2 ! ¯ ¯ ¯ t=2 t=0 +f2 h 2 à t 3 3 − t 2 2 ! ¯ ¯ ¯ t=2 t=0 = f0 h 2 µ 2 3 ¶ − f1h µ−4 3 ¶ + f2 h 2 µ 2 3 ¶ = h 3 (f0 + 4f1 + f2). and the proof is complete. We postpone a sample proof of Corollary 4.1 until Section 4.2. Example 2.1. Consider the function f(x) = 1+e −x sin(4x), the equally spaced spaced quadrature nodes x0 = 0.0, x1 = 0.5, x2 = 1.0, x3 = 1.5, and x4 = 2.0, and the corresponding function values f0 = 1.00000, f2 = 0.72159, f3 = 0.93765, and f4 = 1.13390. Apply the various quadrature formulas (2.4) through (2.7). 9
The step size is h=0.5, and the computations are 0.5 f()dx≈n(1.0000+1.5152)=063788 (x)d≈05 1.00000+4(1 +0.72159)=1.32128 1.5 3(0.5) f(x)dr"8(1.0000131.5152)+3(0.72159)+0.93765) =1.64193 2.0 ∫(a)d45(7(0000245152+12072159 +32(0.93765)+7(1.13390)=1.29444 It is important to realize that the quadrature formulas(4. 4)through(4.7) applied in he above illustration give approximations for definite integrals over different intervals The graph of the curve y= f(ar) and the areas under the Lagrange polynomials y Pi(),y= P2(a),y= P3(a), and P4(a)are shown in Figure 4.2(a)through(d) respectively. In Example 4.1 we applied the quadrature rules with h=0.5. If the endpoints of the interval a, b are held fixed, the step size must be adjusted for each rule. The step sizes are h= b-a,h=(b-a)/2, h=(b-a)/ 3, and h=(b-a)/4 for the trapezoidal rule, Simpson' s rule, Simpsons rule, and Boole's rule, respectively. The next example illustrates this point Example 2.2 Consider the integration of the function f()=l+e-r sin(4. r)over the fixed interval a, b=[0, 1. Apply the various formulas(4. 4)through(4.7) or the trapezoidal rule, h= l and f(x)dt≈2(f(o)+f(1) (1.00000+0.72159)=0.86079 For Simpsons rule, h= 1/2, we get f(a)d≈-2(f(0)+4f(1/2)+f() (1.00000+4(1.55152)+0.72159)=1.32128 For Simpson's a rule,h=1/3, and we obtain /)b≈8 8(0+3f()+3f(5)+f(1)
The step size is h = 0.5, and the computations are Z 0.5 0 f(x)dx ≈ 0.5 2 (1.00000 + 1.55152) = 0.63788 Z 1.0 0 f(x)dx ≈ 0.5 3 (1.00000 + 4(1.55152) + 0.72159) = 1.32128 Z 1.5 0 f(x)dx ≈ 3(0.5) 8 (1.00000 + 3(1.55152) + 3(0.72159) + 0.93765) = 1.64193 Z 2.0 0 f(x)dx ≈ 2(0.5) 45 (7(1.00000) + 32(1.55152) + 12(0.72159) +32(0.93765) + 7(1.13390)) = 1.29444. It is important to realize that the quadrature formulas (4.4) through (4.7) applied in the above illustration give approximations for definite integrals over different intervals. The graph of the curve y = f(x) and the areas under the Lagrange polynomials y = P1(x), y = P2(x), y = P3(x), and P4(x) are shown in Figure 4.2 (a) through (d), respectively. In Example 4.1 we applied the quadrature rules with h = 0.5. If the endpoints of the interval [a, b] are held fixed, the step size must be adjusted for each rule. The step sizes are h = b − a, h = (b − a)/2, h = (b − a)/3, and h = (b − a)/4 for the trapezoidal rule, Simpson’s rule, Simpson’s 3 8 rule, and Boole’s rule, respectively. The next example illustrates this point. Example 2.2 Consider the integration of the function f(x) = 1 + e −x sin(4x) over the fixed interval [a, b] = [0, 1]. Apply the various formulas (4.4) through (4.7). For the trapezoidal rule, h = 1 and Z 1 0 f(x)dx ≈ 1 2 (f(0) + f(1)) = 1 2 (1.00000 + 0.72159) = 0.86079. For Simpson’s rule, h = 1/2, we get Z 1 0 f(x)dx ≈ 1/2 3 (f(0) + 4f(1/2) + f(1)) = 1 6 (1.00000 + 4(1.55152) + 0.72159) = 1.32128. For Simpson’s 3 8 rule, h = 1/3, and we obtain Z 1 0 f(x)dx ≈ 3(1/3) 8 (f(0) + 3f( 1 3 ) + 3f( 2 3 ) + f(1)) 10
(1.00000+3(1.69642)+3(1.23447)+0.72159)=1.31440 For Boole's rule, h=1/4, and the result is (1/4 f() (7∫(0)+32f(7)+12f(5)+32f()+7f(1) 7(1.0+32(1.65534)+12(1.55152) +32(1.066+7(0.72159)=1.30859 The true value of the definite integral is f(a)dr le-4 cos(4)-sin(4) =1.3082506046426 17e and the approximation 1.30859 from Boole's rule is best, the area under each of the Lagrange polynomials P1(), P2(r), P3(ar), and P4(a) is shown in Figure 2.3(a) through Figure 2.3(a) the trapezoidal rule used over [0, 1 yields the approximation 0.86079 (b)simpson's rule used over 0, 1 yields the approximation 1. 32128.(c) simpson's rule used over [ 0, 1] yields the approximation 1.31440. d boole's rule used over 0, 1] yields the approximation 1. 30859 To make a fair comparison of quadrature methods, we must use the same number of function evaluations in each method. Our final example is concerned with comparing integration over a fixed interval [a, b] using exactly five function evaluations f&= f(ak) for k=0, 1, ., 4 for each method. When the trapezoidal rule is applied on the four subintervals o, 1,[1, T21, 2, T3, and [c3, r4, it is called a composite trapezoidal f(ar)d.c f(a)dx+/f(x)dx+/f(x)dx+/f(x)dr 2(o+6)+2(+2)+2(2+3)+2(8+A (f0+2f1+2f2+2f3+f4) Simpson's rule can also be used in this manner. When Simpson's rule is applied on the two subintervals [=o, a2] and [c2, c4, it is called a composite Simpson s rule f(ar)d f(a)dx+/f(r)d (fo+4+f2)+a(/2+48+f4) (4.18)
= 1 8 (1.00000 + 3(1.69642) + 3(1.23447) + 0.72159) = 1.31440. For Boole’s rule, h = 1/4, and the result is Z 1 0 f(x)dx ≈ 2(1/4) 45 (7f(0) + 32f( 1 4 ) + 12f( 1 2 ) + 32f( 3 4 ) + 7f(1)) = 1 90 ³ 7(1.00000) + 32(1.65534) + 12(1.55152) +32(1.06666) + 7(0.72159)´ = 1.30859. The true value of the definite integral is Z 1 0 f(x)dx = 21e − 4 cos(4) − sin(4) 17e = 1.3082506046426 . . . , and the approximation 1.30859 from Boole’s rule is best, the area under each of the Lagrange polynomials P1(x), P2(x), P3(x), and P4(x) is shown in Figure 2.3(a) through (d), respectively. Figure 2.3 (a) the trapezoidal rule used over [0,1] yields the approximation 0.86079 (b) simpson’s rule used over [0,1] yields the approximation 1.32128. (c) simpson’s rule used over [0,1] yields the approximation 1.31440. [d] boole’s rule used over [0,1] yields the approximation 1.30859. To make a fair comparison of quadrature methods, we must use the same number of function evaluations in each method. Our final example is concerned with comparing integration over a fixed interval [a, b] using exactly five function evaluations fk = f(xk), for k = 0, 1, . . . , 4 for each method. When the trapezoidal rule is applied on the four subintervals [x0, x1], [x1, x2], x2, x3], and [x3, x4], it is called a composite trapezoidal rule: Z x4 x0 f(x)dx = Z x1 x0 f(x)dx + Z x2 x1 f(x)dx + Z x3 x2 f(x)dx + Z x4 x3 f(x)dx ≈ h 2 (f0 + f1) + h 2 (f1 + f2) + h 2 (f2 + f3) + h 2 (f3 + f4) (4.17) = h 2 (f0 + 2f1 + 2f2 + 2f3 + f4). Simpson’s rule can also be used in this manner. When Simpson’s rule is applied on the two subintervals [x0, x2] and [x2, x4], it is called a composite Simpson’s rule: Z x4 x0 f(x)dx = Z x2 x0 f(x)dx + Z x4 x2 f(x)dx ≈ h 3 (f0 + 4f1 + f2) + h 3 (f2 + 4f3 + f4) (4.18) 11
h (fo+4f1+2/2+4f3+f4) The next example compares the values obtained with(2.17),(2. 18), and(2.7) Example 2.3. Consider the integration of the function f(a)=1+e-tsin(4.r)over a, b=0, 1. Use exactly five function evaluations and compare the results from the composite trapezoidal rule, composite Simpson rule, and Boole's rule The uniform step size is h= 1/4. The composite trapezoidal rule(2.17)produces f(x)dx≈(f(0)+2f(7)+2f()+2f(7)+f(1) (1.0000+2(1.65534)+2(1.55152)+2(1.066+0.72159) Using the composite Simpson's rule(2. 18), we get f()≈2(0)+(2)+)+4()+/() 1.00000+4(1.65534)+2(1.55152)+4(1.0666+0.72159) 1.30938 We have already seen the result of Boole's rule in Example 7.2 f(x)dx≈ 2(1/4) (7∫(0)+32f(7)+12f()+32f()+7f(1) 1.30859. Figure 2. 4(a) the composite trapezoidal rule yields the approximation 1. 28358.(b) the composite simpson rule yields the approximation 1.30938 The true value of the integral is 2le cos SIn f(ad =1.30825046426 17e and the approximation 1.30938 from Simpson s rule is much better than the value 1.28358 obtained from the trapezoidal rule. Again, the approximation 1.30859 from Boole's rule is closest. Graphs for the areas under the trapezoids and parabolas are shown in Figure 2. 4(a)and(b), respectively Example 2.4 determine the degree of precision of Simpsons a rule
= h 3 (f0 + 4f1 + 2f2 + 4f3 + f4) The next example compares the values obtained with (2.17), (2.18), and(2.7). Example 2.3. Consider the integration of the function f(x) = 1 + e −x sin(4x) over [a, b] = [0, 1]. Use exactly five function evaluations and compare the results from the composite trapezoidal rule, composite Simpson rule, and Boole’s rule. The uniform step size is h = 1/4. The composite trapezoidal rule (2.17) produces Z 1 0 f(x)dx ≈ 1/4 2 (f(0) + 2f( 1 4 ) + 2f( 1 2 ) + 2f( 3 4 ) + f(1)) = 1 8 (1.00000 + 2(1.65534) + 2(1.55152) + 2(1.06666) + 0.72159) = 1.28358 Using the composite Simpson’s rule (2.18), we get Z 1 0 f(x)dx ≈ 1/4 3 (f(0) + 4f( 1 4 ) + 2f( 1 2 ) + 4f( 3 4 ) + f(1)) = 1 12 (1.00000 + 4(1.65534) + 2(1.55152) + 4(1.06666) + 0.72159) = 1.30938 We have already seen the result of Boole’s rule in Example 7.2: Z 1 0 f(x)dx ≈ 2(1/4) 45 (7f(0) + 32f( 1 4 ) + 12f( 1 2 ) + 32f( 3 4 ) + 7f(1)) = 1.30859. Figure 2.4 (a) the composite trapezoidal rule yields the approximation 1.28358. (b) the composite simpson rule yields the approximation 1.30938. The true value of the integral is Z 1 0 f(x)dx = 21e − 4 cos(4) − sin(4) 17e = 1.30825046426 . . . , and the approximation 1.30938 from Simpson’s rule is much better than the value 1.28358 obtained from the trapezoidal rule. Again, the approximation 1.30859 from Boole’s rule is closest. Graphs for the areas under the trapezoids and parabolas are shown in Figure 2.4(a) and (b), respectively. Example 2.4 determine the degree of precision of Simpson’s 3 8 rule. 12
It will suffice to apply Simpson's rule over the interval [ 0, 3 with the five test functions f(r)=l, r2, r3 and a4. For the first four functions, Simpson's8 rule is exact 3 (1+3(1)+3(1)+1) (0+3(1)+3(2)+3) (0+3(1)+3(4)+9) (0+3(1)+3(8)+27) The function f(a)=r is the lowest power of x for which the rule is not exact 243993 (0+3(1)+3(16)+81) Therefore, the degree of precision of Simpson's rule is n=3 4.1.1 Exercises for introduction to quadrature 1. Consider integration of f(a) over the fixed interval a, 6=0, 1. Apply the various quadrature formulas(4)through(7). The step sizes are h= l, h=5,h=3,and h=i for the trapezoidal rule, Simpson's rule, Simpson's 3 rule, and Boole's rule respectively (a) f(ar)= sin( r) (b)f(a)=1+e- cos(4. r) (c)f(x)=sin(√ Remark. The true values of the definite integrals are(a 2/T=0.636619772367 (b)18e-cos(4)+4sin(4)/(17e)=-1.007459631397..,and(c)2(sin(1)-cos(1)= 0.602337357879.... Graphs of the functions are shown in Figures 2.5(a) through(c) respectively 2. Consider integration of over the fixed interval a, b=[0, 1. Apply the various quadra- ture formulas; the composite trapezoidal rule(2. 17), the composite Simpson rule(2. 18) and Boole's rule(2.7). Use five function evaluations at equally spaced nodes. The uni form step size is h= (a)f(x)=sin(丌x) (b )f(a)=1+e- cos(4. r) (c)f(a)=sin(v r 3. Consider a general interval [ a, b. Show that Simpson's rule produces exact result for the functions f(r)=x2 and f(a)=., that is
It will suffice to apply Simpson’s 3 8 rule over the interval [0, 3] with the five test functions f(x) = 1, x, x2 , x3 and x 4 . For the first four functions, Simpson’s 3 8 rule is exact. Z 3 0 1dx = 3 = 3 8 (1 + 3(1) + 3(1) + 1) Z 3 0 xdx = 9 2 = 3 8 (0 + 3(1) + 3(2) + 3) Z 3 0 x 2 dx = 9 = 3 8 (0 + 3(1) + 3(4) + 9) Z 3 0 x 3 dx = 81 4 = 3 8 (0 + 3(1) + 3(8) + 27). The function f(x) = x 4 is the lowest power of x for which the rule is not exact. Z 3 0 x 4 dx = 243 5 ≈ 99 2 = 3 8 (0 + 3(1) + 3(16) + 81). Therefore, the degree of precision of Simpson’s 3 8 rule is n = 3. 4.1.1 Exercises for introduction to quadrature 1. Consider integration of f(x) over the fixed interval [a, b] = [0, 1]. Apply the various quadrature formulas (4) through (7). The step sizes are h = 1, h = 1 2 , h = 1 3 , and h = 1 4 for the trapezoidal rule, Simpson’s rule, Simpson’s 3 8 rule, and Boole’s rule, respectively. (a) f(x) = sin(πx) (b) f(x) = 1 + e −x cos(4x) (c) f(x) = sin(√ x) Remark. The true values of the definite integrals are (a)2/π = 0.636619772367 . . ., (b) 18e − cos(4) + 4 sin(4))/(17e) = −1.007459631397 . . ., and (c) 2(sin(1) − cos(1)) = 0.602337357879 . . .. Graphs of the functions are shown in Figures 2.5(a) through (c), respectively. 2. Consider integration of over the fixed interval [a, b]=[0, 1]. Apply the various quadrature formulas; the composite trapezoidal rule (2.17), the composite Simpson rule (2.18), and Boole’s rule (2.7). Use five function evaluations at equally spaced nodes. The uniform step size is h = 1 4 . (a) f(x) = sin(πx) (b) f(x) = 1 + e −x cos(4x) (c) f(x) = sin(√ x) 3. Consider a general interval [a, b]. Show that Simpson’s rule produces exact results for the functions f(x) = x 2 and f(x) = x 3 ; that is, 13