h _ 16

h = 24

Fig. 8.42

According to our analysis, the total force on the upper half of the window is thus

20 44880

h · 50 · (2h ’ 32) dh = lbs.

3

16

For the lower half of the window, we examine the isosceles right triangle in

Fig. 8.43. It has base 24 ’ h. Therefore, for h ranging from 20 to 24, we have

w(h) = 2(24 ’ h) = 48 ’ 2h.

According to our analysis, the total force on the lower half of the window is

24 51200

h · 50 · (48 ’ 2h) dh = lbs.

3

20

The total force on the entire window is thus

44880 51200 96080

+ = lbs.

3 3 3

You Try It: A tank of water has ¬‚at sides. In one side, with center 4 feet below the

surface of the water, is a circular window of radius 1 foot. What is the total force

on the window?

252 CHAPTER 8 Applications of the Integral

h = 16

4√2

24 _ h

h = 24

Fig. 8.43

8.7 Numerical Methods of Integration

While there are many integrals that we can calculate explicitly, there are many

others that we cannot. For example, it is impossible to evaluate

e’x dx.

2

(—)

That is to say, it can be proved mathematically that no closed-form antiderivative can

be written down for the function e’x . Nevertheless, (—) is one of the most important

2

integrals in all of mathematics, for it is the Gaussian probability distribution integral

that plays such an important role in statistics and probability.

Thus we need other methods for getting our hands on the value of an integral.

One method would be to return to the original de¬nition, that is to the Riemann

sums. If we need to know the value of

1

e’x dx

2

0

then we can approximate this value by a Riemann sum

1

e’x dx ≈ e’(0.25) · 0.25 + e’(0.5) · 0.25 + e’(0.75) · 0.25 + e’1 · 0.25.

2 2 2 2 2

0

A more accurate approximation could be attained with a ¬ner approximation:

10

1

’x 2

e’(j ·0.1) · 0.1

2

dx ≈ (——)

e

0 j =1

253

CHAPTER 8 Applications of the Integral

or

100

1

’x 2

e’(j ·0.01) · 0.01

2

dx ≈ ()

e

0 j =1

The trouble with these “numerical approximations” is that they are calcula-

tionally expensive: the degree of accuracy achieved compared to the number of

calculations required is not attractive.

Fortunately, there are more accurate and more rapidly converging methods for

calculating integrals with numerical techniques. We shall explore some of these in

the present section.

It should be noted, and it is nearly obvious to say so, that the techniques of

this section require the use of a computer. While the Riemann sum (——) could be

computed by hand with some considerable effort, the Riemann sum ( ) is all but

infeasible to do by hand. Many times one wishes to approximate an integral by the

sum of a thousand terms (if, perhaps, ¬ve decimal places of accuracy are needed).

In such an instance, use of a high-speed digital computer is virtually mandatory.

8.7.1 THE TRAPEZOID RULE

The method of using Riemann sums to approximate an integral is sometimes called

“the method of rectangles.” It is adequate, but it does not converge very quickly

and it begs more ef¬cient methods. In this subsection we consider the method of

approximating by trapezoids.

Let f be a continuous function on an interval [a, b] and consider a partition

P = {x0 , x1 , . . . , xk } of the interval. As usual, we take x0 = a and xk = b. We also

assume that the partition is uniform.

Fig. 8.44

In the method of rectangles we consider a sum of the areas of rectangles.

Figure 8.44 shows one rectangle, how it approximates the curve, and what error

254 CHAPTER 8 Applications of the Integral

is made in this particular approximation. The rectangle gives rise to a “triangular”

error region (the difference between the true area under the curve and the area of the

rectangle). We put quotation marks around the word “triangular” since the region

in question is not a true triangle but instead is a sort of curvilinear triangle. If we

instead approximate by trapezoids, as in Fig. 8.45 (which, again, shows just one

region), then at least visually the errors seem to be much smaller.

Fig. 8.45

In fact, letting x = xj ’ xj ’1 as usual, we see that the ¬rst trapezoid in the

¬gure has area [f (x0 )+f (x1 )]· x/2. The second has area [f (x1 )+f (x2 )]· x/2,

and so forth. In sum, the aggregate of the areas of all the trapezoids is

1 1

· {f (x0 ) + f (x1 )} · x + · {f (x1 ) + f (x2 )} · x + ···

2 2

1

+ · {f (xk’1 ) + f (xk )} · x

2

x

= · {f (x0 ) + 2f (x1 ) + 2f (x2 )

2

+ · · · + 2f (xk’1 ) + f (xk )}. (†)

It is known that, if the second derivative of f on the interval [a, b] does not exceed

M then the approximation given by the sum (†) is accurate to within

M · (b ’ a)3

.

12k 2

[By contrast, the accuracy of the method of rectangles is generally not better than

N · (b ’ a)2

,

2k

where N is an upper bound for the ¬rst derivative of f . We see that the

method of trapezoids introduces an extra power of (b ’ a) in the numerator

255

CHAPTER 8 Applications of the Integral

of the error estimate and, perhaps more importantly, an extra factor of k in the

denominator.]

EXAMPLE 8.29

Calculate the integral

1

e’x dx

2

0

to two decimal places of accuracy.

SOLUTION

We ¬rst calculate that if f (x) = e’x then f (x) = (4x 2 ’ 2)e’x and

2 2

therefore |f (x)| ¤ 2 = M for 0 ¤ x ¤ 1. In order to control the error, and to

have two decimal places of accuracy, we need to have

M · (b ’ a)3

< 0.005

12k 2

or

2 · 13

< 0.005.

12k 2

Rearranging this inequality gives

100

< k2.

3

Obviously k = 6 will do.

So we will use the partition P = {0, 1/6, 1/3, 1/2, 2/3, 5/6, 1}. The corres-

ponding trapezoidal sum is

1/6 ’02

+ 2e’(1/6) + 2e’(1/3) + 2e’(1/2)

2 2 2

S= ·e

2

+ 2e’(2/3) + 2e’(5/6) + e’1 .

2 2 2

Some tedious but feasible calculation yields then that

1

S= · {1 + 2 · .9726 + 2 · .8948 + 2 · .7880

12

+ 2 · .6412 + 2 · .4994 + .3679}

8.9599

= = .7451.

12

We may use a computer algebra utility like Mathematica or Maple to

calculate the integral exactly (to six decimal places) to equal 0.746824. We thus

see that the answer we obtained with the Trapezoid Rule is certainly accurate

to two decimal places. It is not accurate to three decimal places.

256 CHAPTER 8 Applications of the Integral

It should be noted that Maple and Mathematica both use numerical tech-

niques, like the ones being developed in this section, to calculate integrals. So our

calculations merely emulate what these computer algebra utilities do so swiftly and

so well.

You Try It: How ¬ne a partition would we have needed to use if we wanted four

decimal places of accuracy in the last example? If you have some facility with a

computer, use the Trapezoid Rule with that partition and con¬rm that your answer

agrees with Mathematica™s answer to four decimal places.

EXAMPLE 8.30

Use the Trapezoid Rule with k = 4 to estimate

1

1

dx.

1 + x2

0

SOLUTION

Of course we could calculate this integral precisely by hand, but the point

here is to get some practice with the Trapezoid Rule. We calculate

±

1/4 1 1

1 1 1

S= · +2· +2· +2· + .

2 1+02 1+12

2 2 2

1 2 3

1+ 4 1+ 4 1+ 4

A bit of calculation reveals that

1 5323

S= · ≈ 0.782794 . . . .

8 850

Now if we take f (x) = 1/(1 + x 2 ) then f (x) = (6x 2 ’ 2)/(1 + x 2 )3 .

Thus, on the interval [0, 1], we have that |f (x)| ¤ 4 = M. Thus the error

estimate for the Trapezoid Rule predicts accuracy of

M · (b ’ a)3 4 · 13

= ≈ 0.020833 . . . .

12 · 42

12k 2

This suggests accuracy of one decimal place.

Now we know that the true and exact value of the integral is arctan 1 ≈

0.78539816 . . .. Thus our Trapezoid Rule approximation is good to one, and

nearly to two, decimal places”better than predicted.

8.7.2 SIMPSON™S RULE

Simpson™s Rule takes our philosophy another step: If rectangles are good, and

trapezoids better, then why not approximate by curves? In Simpson™s Rule, we

approximate by parabolas.

257

CHAPTER 8 Applications of the Integral

We have a continuous function f on the interval [a, b] and we have a partition

P = {x0 , x1 , . . . , xk } of our partition as usual. It is convenient in this technique to

assume that we have an even number of intervals in the partition.

Fig. 8.46

Now each rectangle, over each segment of the partition, is capped off by an

arc of a parabola. Figure 8.46 shows just one such rectangle. In fact, for each pair

of intervals [x2j ’2 , x2j ’1 ], [x2j ’1 , x2j ], we consider the unique parabola passing

through the endpoints

(—)

(x2j ’2 , f (x2j ’2 )), (x2j ’1 , f (x2j ’1 )), (x2j , f (x2j )).

Note that a parabola y = Ax 2 + Bx + C has three undetermined coef¬cients, so

three points as in (—) will determine A, B, C and pin down the parabola.

In fact (pictorially) the difference between the parabola and the graph of f is

so small that the error is almost indiscernible. This should therefore give rise to a

startling accurate approximation, and it does.

Summing up the areas under all the approximating parabolas (we shall not

perform the calculations) gives the following approximation to the integral:

b x

f (x) dx ≈ {f (x0 ) + 4f (x1 ) + 2f (x2 ) + 4f (x3 )

3

a

+ 2f (x4 ) + · · · + 2f (xk’2 ) + 4f (xk’1 ) + f (xk )}.

If it is known that the fourth derivative f (iv) (x) satis¬es |f (iv) (x)| ¤ M on [a, b],

then the error resulting from Simpson™s method does not exceed

M · (b ’ a)5

.

180 · k 4

258 CHAPTER 8 Applications of the Integral

EXAMPLE 8.31

e’x dx to two decimal places of

2

1

Use Simpson™s Rule to calculate 0

accuracy.

SOLUTION

If we set f (x) = e’x then it is easy to calculate that

2

f (iv) (x) = e’x · [12 ’ 72x 2 + 32x 4 ].

2

Thus |f (x)| ¤ 12 = M.

In order to achieve the desired degree of accuracy, we require that

M · (b ’ a)5

< 0.005

180 · k 4

or

12 · 15

< 0.005.

180 · k 4

Y

Simple manipulation yields

FL

200

< k4.

15

AM

This condition is satis¬ed when k = 2.

Thus our job is easy. We take the partition P = {0, 1/2, 1}. The sum arising

from Simpson™s Rule is then

TE

1/2

S= {f (0) + 4f (1/2) + f (1)}

3

1

= {e’0 + 4 · e’(1/2) + e’1 }

2 2 2

6

1

= {1 + 3.1152 + 0.3679}

6

1

≈ · 4.4831

6

≈ 0.7472

Comparing with the “exact value” 0.746824 for the integral that we noted in

Example 8.29, we ¬nd that we have achieved two decimal places of accuracy.

It is interesting to note that if we had chosen a partition with k = 6, as we did

in Example 8.29, then Simpson™s Rule would have guaranteed an accuracy of

M · (b ’ a)5 12 · 15

= ≈ 0.00005144,

180 · k 4 180 · 64

or nearly four decimal places of accuracy.

259

CHAPTER 8 Applications of the Integral

EXAMPLE 8.32

Estimate the integral

1

1

dx

1 + x2

0

using Simpson™s Rule with a partition having four intervals. What degree of

accuracy does this represent?

SOLUTION

Of course this example is parallel to Example 8.30, and you should compare

the two examples. Our function is f (x) = 1/(1 + x 2 ) and our partition is

P = {0, 1/4, 2/4, 3/4, 1}. The sum from Simpson™s Rule is

1/4

S= · {f (0) + 4f (1/4) + 2f (1/2) + 4f (3/4) + f (1)}

3

1 1 1

= · +4·

1 + 02 1 + (1/4)2

12

1 1 1