Example 154 if the integrand f x happens to be

This preview shows page 10 - 12 out of 39 pages.

Example 15.4. If the integrand f ( x ) happens to be periodic on the interval [ a , b ], implying in par- ticular that f ( b ) = f ( a ), then the trapezoidal method reads b a f ( x ) dx h r 1 i = 0 f ( t i ). As it turns out, the composite trapezoidal method is particularly accurate for periodic func- tions. The reason for this is beyond the scope of this chapter; it has to do with best 2 -approximation and trigonometric polynomials. There are intriguing connections between this very simple compos- ite quadrature method and the discrete Fourier transform (DFT) described in Sections 13.2 and 13.3. Here, let us just give a numerical example. Thus, consider the same integrand as in Example 15.3, but on the interval [ 10,10]. At both interval ends this function and many of its derivatives are close to 0, so it is almost periodic. Figure 15.4 depicts the performance of the composite trapezoidal and Simpson methods. The trape- zoidal method yields spectacular results here. We hasten to caution, though, that the typical picture would be more like Figure 15.3 than Figure 15.4. The computational cost of a quadrature method Using composite quadrature methods we can drive the discretization error to be arbitrarily small by taking h smaller and smaller. 57 The price, however, is an increased computational cost. How 57 We still assume that the discretization error dominates roundoff error. So, although the total error does not really tend to 0 in the pure sense as h 0, we can still concentrate on a practical range of values of h where the error in a method of order q decreases proportionally to h q . Downloaded 12/08/18 to 132.174.255.3. Redistribution subject to SIAM license or copyright; see
15.2. Composite numerical integration 451 30 35 40 45 50 55 60 65 10 16 10 14 10 12 10 10 10 8 10 6 10 4 10 2 r error trap error Simp Figure 15.4. Numerical integration errors for the composite trapezoidal and Simpson methods; see Example 15.4 . can the algorithm s cost be quickly estimated? Typically, we imagine integrating a function f ( x ) which is relatively expensive to evaluate and measure the approximate cost of a particular quadra- ture method by the number of evaluations of the function f that are required. In other words, we assume that function evaluations are signi fi cantly more costly than summation and the other arith- metic operations involved in quadrature. (You may recall that we use a similar approach in assessing computational cost of other algorithms; see, for example, Chapter 3.) We see that for the same value of h the costs of the composite trapezoidal method and the composite Simpson method are compa- rable. Example 15.5. Approximate 1 0 e x 2 dx with an absolute error less than 10 5 . Using the composite Simpson method we have 1 0 e x 2 dx = h 3 1 + 2 r / 2 1 k = 1 e t 2 2 k + 4 r / 2 k = 1 e t 2 2 k 1 + e 1 f ′′′′ ( ζ ) 180 ( b a ) h 4 , where t k = kh . Here, since f ( x ) = e x 2 is particularly simple, we can calculate and bound the fourth derivative, obtaining f ′′ ( x ) = ( 2 + 4 x 2 ) e x 2 , f ′′′′ ( x ) = (12 48 x

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture