26
C
H
A
P
T
E
R
Numerical Methods of
Approximating Definite
Integrals
26.1
APPROXIMATING SUMS:
L
n,
R
n,
T
n,
AND
M
nIntroduction
Not only can we differentiate all the basic functions we’ve encountered, polynomials, exponential and logarithmic functions, trigonometric and inverse trigonometric functions, and rational functions, but armed with the Product and Chain Rules, we can happily differentiate any new function constructed by multiplication, division, addition, subtraction, or composition of these functions. This gives us a sense of competence and satisfaction.
Although at this point we can integrate many functions, there are basic functions (such as lnx and secx) that we have not yet tackled.1From the Chain Rule for differentiation we get the technique of substitution for antidifferentiation; from the Product Rule for differentiation we get a technique of antidifferentiation known as Integration by Parts. (The latter is something to look forward to learning in Chapter 29.) Learning more sophisticated methods of substitution and algebraic manipulation will enlarge the collection of functions we can antidifferentiate. Tables of integrals and high-powered computer packages can provide assistance if we’re in dire straits. Nevertheless, there are some very innocent-looking functions that cannot be dealt with easily. For instance, all the technical skill in the world won’t help us find an antiderivative fore−x2, or sin(x2), or sin(1x).2Knowing that there is no guarantee that wecanantidifferentiate can be unnerving. This chapter will restore our sense of having things under control when we are faced with a definite integral.
Suppose we are interested in evaluating a definite integral and we have not found an antiderivative for the integrand. In any practical situation we’ll need to evaluate the definite
1!
lnx dx=xlnx−x+C(verify this for yourself). This can be found either by some serious guess-work, methods given in Section 27.3, or using the technique called Integration by Parts.
With some work we can integrate secx.!
secx dx=!secx·secsecxx++tantanxxdx=! secsec2x+xsec+tanxtanx xdx=ln|secx+tanx| +C.
2That is, if we want to obtain an antiderivative that is afinitesum, product, or composition of the elementary functions.
integral with a certain degree of accuracy. Provided that an approximation is satisfactory, it is not necessary to be able to find an antiderivative of the integrand. Instead, we return to the basic ideas that led us to the limit definition of the definite integral.
The theoretical underpinnings of calculus involve the method of successive approxi-mations followed by a limiting process.
Differential Calculus
Letfbe a differentiable function. We obtain numericalapproximationsof the slope of the tangent to the graph off at pointP by looking at the slope of secant lines through P andQ, whereQis a point on the graph off very close toP. By taking thelimitas QapproachesP we determine the exact slope of the tangent line atP.
y = f(x) P Q x = a x = b Figure 26.1 Integral Calculus
Letf be an integrable function. We obtain numericalapproximationsof the signed area between the graph off and thex-axis on [a,b] by partitioning the interval [a,b] into many equal subintervals, treatingf as if it is constant on each tiny subinterval, and approximating the signed area with a Riemann sum. By taking thelimitas the number of subintervals increases without bound we determine the definite integral.
In this chapter we return to Riemann sums to obtain approximations of definite in-tegrals. The numerical methods discussed here are often used in practice. Computers or programmable calculators are ideal for performing the otherwise tedious calculations.
Approximating Sums:
L
n,
R
n,
T
n, and
M
nIn the context of the following example we’ll discuss left-hand, right-hand, midpoint, and trapezoidal sums, sums that can be used to approximate a definite integral. In order to be able to compare our approximations with the actual value, we’ll look at an integral we can evaluate exactly .
◆
EXAMPLE 26.1
Approximate!15 1x dx. Keep improving upon the approximation until you know the value
to four decimal places.
SOLUTION (i) To approximate the integral we chop up the interval of integration intonequal subinter-vals, (ii) approximate the area under the curve on each subinterval by the area of a rectangle, and (iii) sum the areas of these rectangles.
We’ll construct three Riemann sums: the left- hand sum, denoted byLn; the right-hand sum,
denoted byRn; and the midpoint sum, denoted byMn. (We are already familiar with the
first two.) We describe these sums as follows.
Ln: The height of the rectangle on each subinterval is given by the value off at the
left-hand endpoint of the subinterval.
Rn: The height of the rectangle on each subinterval is given by the value off at the
right-hand endpoint of the subinterval.
Mn: The height of the rectangle on each subinterval is given by the value off at
the midpoint of the subinterval. On theit hinterval, [xi−1,xi], the height of the
rectangle isf (c), wherecis midway betweenxi−1andxi;c=xi−12+xi.
4 Subdivisions
Letn=4; we chop [1, 5] into 4 equal subintervals each of length!x=5−41=1. ∆x = 1
1 2 3 4 5
Below are the left- hand sum, the right-hand sum, and the midpoint sum.
1 2 3 4 5 f x L4 = 1 1 • 1 + • 1 + • 1 + • 1 1 2 1 3 1 4 = = 2.083 1 1 + + + 1 2 1 3 1 4 1 2 3 4 5 f x R4 = 12 • 1 + 31 • 1 +14 • 1 +15• 1 = = 1.283 1 2 + + + 1 3 1 4 1 5 1 2 1.5 2.5 3.5 4.53 4 5 f x M4 = 23 • 1 + 52 • 1 +27• 1 +29• 1 = = 1.574...3 2 3 + + + 2 5 2 7 2 9 Figure 26.2
The functionf (x)=1x is decreasing; therefore the left-hand sums provide an upper bound and the right-hand sums a lower bound for!15x1dx.
1.283. . .=R4<
" 5 1
1
x dx < L4=2.083. . .
Suppose we take the average ofR4andL4, L4+2R4. This is closer to the value of the integral than either the right- or left-hand sums. Geometrically this average is equivalent to approximating the area on each interval by a trapezoid instead of a rectangle, as shown below in Figure 26.3. 1 2 3 4 5 f A D B C E F x xi–1 xi (a) (b) Figure 26.3
Averaging the area of rectangles of ABCD and AEFD in Figure 26.3(a) gives the area of the trapezoid AECD.
We refer to the average of the left- and right- hand sums, Ln+Rn
2 , as thetrapezoidal
sum(or the Trapezoidal rule) and denote it byTn.
T4=1.283. . .+2.083. . .
2 =1.683. . .
Becausef is concave up4on [1, 5] we know that on each subinterval the area under the trapezoid is larger than that under the curve. ThusT4gives an upper bound for the integral, a better upper bound than that provided byL4.
R4< " 5 1 1 x dx < T4< L4 1.283. . . < 1 x dx <1.683. . . <2.083. . .
At this point the mind of the critical reader should be buzzing with questions. Perhaps they include the following.
What are the conditions under whichTnwill be larger than the value of the integral?
Smaller?
Where does the midpoint sumfit into the picture? Let’s investigate thefirst question by looking at some graphs.
4f (t )=1
x x x x
x x
Figure 26.4
Iff is concave up on [a,b], then every secant line joining two points on the graph of f on [a,b] liesabovethe graph.
Iff is concave down on [a,b], then every secant line joining two points on the graph off on [a,b] liesbelowthe graph.
We conclude that " b a f (t ) dt < Tn iff is concave up on [a,b], and Tn< " b a
f (t ) dt iff is concave down on [a,b].
Where does the midpoint sumfit into the picture? It turns out thatTn andMnare a
complementary pair. We will show that
iff is concave up on [a,b], thenMn< " b
a
f (t ) dt < Tn while
iff is concave down on [a,b], thenTn< " b
a
f (t ) dt < Mn.
To do this we’ll give an alternative graphical interpretation of the midpoint sum. Figure 26.5(i) illustrates the midpoint approximation, approximating the area under the graph of f on [xi,xi+1] by the area of a rectangle whose height is the value off at the midpoint of the interval. In Figure 26.5(ii) we approximate the area underf by the area of the trapezoid formed by the tangent line to the graph off at the midpoint of the interval. We claim that these areas are identical; pivoting the line through A, B, and C about the midpoint C does not change the area bounded below.
Look at Figure 26.5(iii). The triangles ACD and BCE are congruent. We argue this as follows. Angles CAD and CBE are right angles. Angles ACD and BCE are equal. Therefore the two triangles in question are similar. But AC=CB because C is the midpoint of the interval [xi,xi+1]. We conclude that triangles ACD and BCE are congruent and hence have
the same area. Therefore, rectanglexiABxi+1and trapezoidxiDExi+1(Figures 26.5(i) and (ii), respectively) have the same area; we can interpret the midpoint sum as the midpoint tangent sum.
A C B (i) xi midpt. xi +1 D E E C (ii) xi midpt. xi +1 D B A C (iii)
xi midpt. xi +1 as long as the oblique linecongruent triangles
passes through midpoint C.
E
D
B A C
Figure 26.5
Below is a picture ofM4using the midpoint tangent line interpretation.f is concave up, so the tangent lines lie below the curve. We know that on each subinterval the area under the midpoint tangent line is less than the area under the curve; therefore,M4gives a lower bound for the integral.
f x f x x0 x1 x2 x3 1 2 3 4 5 Figure 26.6
Where a function is concave up its tangent line lies below the curve; where a function is concave down its tangent line lies above the curve. It follows that iff is concave up on [a,b], thenMn<
!b
a f (t ) dt; iff is concave down on [a,b], then !b
a f (t ) dt < Mn.
x1 x2 x3 x1 x2 x3 x1 x2 x1 x2 x3
Figure 26.7
How doLn,Rn,Tn, andMnimprove as we increasen?
8 Subdivisions
f x 1 2 3 4 5 f x 1 2 3 4 5 f x 1 2 2 3 4 5 1 1.5 2 2.5 3 3.5 4 4.5 5 f x 1 2 3 4 5 f x 1 2 3 4 5 OR
midpoint rectangles midpoint tangent trapezoids
M8 = 4
(
5 + 47 + 49+ 411+ 413+154 +174+194(
• 21 = 1.599... L8 = 1(
1 + 23 + 24+ 25+ 26+ 27 + 28+ 29(
• 21 = 1.828... R8 = 2(
3 + 24 + 25+ 26+ 27+ 28 + 29+102(
• 21 = 1.428... T8 = L8 + R8 = 1.628... We know that 1.428. . .=R8< M8=1.599. . . < " 5 1 1 x dx < T8=1.628. . . < L8=1.828. . .. f (x)=1x is decreasing and concave up on [1, 5]. Therefore, we know that for anynRn< " 5 1 1 x dx < Ln and Mn< " 5 1 1 x dx < Tn.
If we are interested in more decimal places, we can simply choose larger values ofn.
50 Subdivisions
Supposen=50; we chop [1, 5] into 50 equal pieces each of length!x=550−1=0.08. We don’t actually want to sum up 50 terms by hand. Work like this is painful to do by hand but it’s child’s play for a programmable calculator or computer. Get out your programmed calculator or computer and check thefigures given below.5
R50=1.577. . . M50=1.60918. . . T50=1.60994. . . L50=1.641. . .
400 Subdivisions
Supposen=400; we chop [1, 5] into 400 equal pieces each of length!x=5400−1=0.01. We obtain
R400=1.60544. . . M400=1.60943. . . T400=1.60944. . . L400=1.61344. . . UsingT400as an upper bound andM400as a lower bound, we’ve nailed down the value of this integral to 4 decimal places.
5You’ll have to enter the following information: the function (often asY1), the endpoints of integration, and the number of
pieces into which you’d like to partition the interval. (And, if you’re using a calculator withoutLn,Rn,Tn, andMnprogrammed,
REMARKM50andT50give better approximations of!15x1dxthan doR400andL400.
◆
Summary of the Underlying Principles
Rn Mn Tn Mn Tn Rn Ln Ln Iff is increasing on [a,b], thenLn<
!b
a f (t ) dt < Rn.
Iff is decreasing on [a,b], thenRn< !b
a f (t ) dt < Ln.
Iff is concave up on [a,b], thenMn< !b
a f (t ) dt < Tn.
Iff is concave down on [a,b], thenTn< !b
a f (t ) dt < Mn.
For any givenn, generally the trapezoidal and midpoint sums are much closer to the actual value of the definite integral than are the left- and right-hand sums.
◆
EXAMPLE 26.2
Approximate!02e−2x2dx byfinding upper and lower bounds differing by no more than 0.001.6SOLUTION This is a great problem on which to practice, because it is impossible tofind an antiderivative forf (x)=e−2x2unless we resort to an infinite sum of terms. Look at the graph off (x). It is decreasing on the interval [0, 2] and appears to have a point of inflection somewhere on this interval.7 f x 1 1 2 f(x) = e–2x2 Figure 26.8
Suppose we were planning to use left- and right-hand sums only. As shown in Sec-tion 22.2, the difference between the left- and right-hand sums is given by
6The functione−kx2is of practical importance because, for the appropriatek, its graph gives the bell-shaped normal distribution
curve. The area under the normal distribution curve over some given interval is of vital importance to probabilists and statisticians.
7How can we besurefis decreasing?f (x)= 1
e2x2. Asxincreases from 0 to 2, 2x
2increases, soe2x2is positive and increasing.
Therefore, its reciprocal is decreasing. Alternatively, d dxe−
2x2=e−2x2(−4x)=−4x
|Rn−Ln| = |f (b)−f (a)| ·!x = |f (b)−f (a)| ·b−a
n .
Therefore, in this example
|Rn−Ln| = |e−8−e0| · 2−0 n = |e −8−1| ·2 n< 1.9994 n .
If we want|Rn−Ln|<0.001, then we can solve1.9994n =0.001 fornand choose any integer
larger than this.
n=1.9994
0.001 =1999.4, so we can choosen=2000.
If your calculator will accept a number this large, you’re in good shape; the left-hand sum will be an upper bound and the right-hand sum will be a lower bound, becausef is de-creasing on [0, 2]. The computation may take some time for the machine to perform, depend-ing upon its power. You should getL2000=0.62711719. . .andR2000=0.62611753. . ..
REMARK Supposefis monotonic8over the interval [a,b], so the actual value of!abf (x) dx is betweenLnandRn. Although it is possible simply to try larger and larger values ofn
untilLnandRnare within the desired distance from one another, it is more efficient, if a
high degree of accuracy is demanded, to use
|Rn−Ln| = |f (b)−f (a)|!x
tofind an appropriate value ofn.
Generally, the midpoint and trapezoidal sums give us much better bounds for a partic-ularn. If wefind the point of inflection, we can use these sums to form a sandwich around the value of the integral.
f (x)=e−2x2 f"(x)= −4xe−2x2
f""(x)= −4[e−2x2+x(−4xe−2x2)]
=4e−2x2(−1+4x2)
f""(x)=0, where−1+4x2=0, that is, wherex2=14. On [0, 2]f""(x)=0 atx=12. Looking back atf""(x)=4e−2x2(−1+4x2), we can see thatf""changes sign (from
negative to positive) atx=12, sox=0.5 is a point of inflection. f is concave down on [0,1
2] and concave up on [12, 2]. Therefore,
on [0,12], Tngives a lower bound for the integral andMngives an upper bound;
on [1
2, 2], Tngives an upper bound for the integral andMngives a lower bound.
f x 1 1 2 1 2 f(x) = e–2x2 Figure 26.9
The combined error on [0,1
2] and [12, 2] must be no more than 0.001. We can split up the allowable error however we want. We can play around with the calculator or computer until the sum of|Tn−Mn|on [0,12] and|Tm−Mm|on [12, 2] is less than 0.001.
Here is the result of some playing around. If we tryn=50 on both intervals, we obtain the following.
On [0, 12] T50=0.427802. . . M50=0.4278170. . . On [1
2, 2] T50=0.198895. . . M50=0.198759. . .
On each interval the difference betweenT50andM50is substantially less than 0.0005. To get thefinal answer we need to add the lower bounds(T50on [0,12] andM50on [12, 2]) to obtain a lower bound for the integral, and add the upper bounds to obtain an upper bound.
" 2 0 e−2x2dx= " .5 0 e−2x2dx+ " 2 .5 e−2x2dx lower bound: 0.427802+0.198759=0.627065 upper bound: 0.428170+0.198895=0.627065
In the next section we will show an alternative and more efficient method of using the trapezoidal and midpoint sums to approximate this integral.
◆
Numerical methods of integration, such as left- and right-hand sums and trapezoidal and midpoint sums, are very useful not only when we are trying to approximate!b
a f (x) dx
and can’tfind an antiderivative forf, but also in situations in which we don’t even have a formula forf. A scientist may be taking periodic data readings, or a surveyor may be taking measurements at preset intervals, and these data sets may constitute the only information we have aboutf. Numerical methods of integration can be applied directly to the data sets. Exercise 26.1 below deals with information from a data set, and the results of Exercise 26.2 and Exercise 26.3 can be easily applied to data sets in which data have been collected at equally spaced intervals.
EXERCISE 26.1 Between noon and 5:00p.m.water has been leaving a reservoir at an increasing rate. We
do not have a rate function at our disposal, but we do have some measurements indicating the rate that water has been leaving at various times. The information is given below. These measurements were not taken at equally spaced time intervals.
Time noon 1:00 1:30 2:00 3:00 3:45 4:15 5:00
Rate out (in gal/hr) 140 160 170 200 250 270 280 300
(a) Find good upper and lower bounds on the amount of water that has left the reservoir between noon and 5:00p.m.
(b) Use a trapezoidal sum to approximate the amount of water that has left the reservoir between noon and 5:00p.m.
Answers are provided at the end of the section.
EXERCISE 26.2 Our aim is to approximate!b
a f (x) dx when we do not have a formula forf (x). Our data
consist of a collection of measurements off (x)taken at equally spaced intervals. Use a trapezoidal sum to approximate the definite integral.
Partition the interval [a,b] into n equal subintervals, each of length !x= b−na. x0,x1,x2,. . ., are as indicated.x0=aandxk=a+k!xfork=1,. . .,n.yk=f (xk)for
k=0,. . .,n. Show that
the trapezoidal sum can be computed as follows: Tn= #1 2 $ [y0+2y1+2y3+ · · · +2yn−1+yn]!x. x1 x0 y0 y1 a x2 x3 x4 xn–1 xn yn–1 yn b= = Figure 26.10
The answer is provided at the end of the section.
Answers to Selected Exercises
Exercise 1
(a) The rate is increasing, so the lower bound is given by the left-hand sum and the upper bound by the right-hand sum.
Lower bound: 140(1)+160(0.5)+170(0.5)+200(1)+250(0.75)+270(0.5)+
280(0.25)=897.5
Upper bound: 160(1)+170(0.5)+200(0.5)+250(1)+270(0.75)+280(0.5)+
300(0.25)=1012.5
(b) The trapezoidal approximation is the average of the left- and right-hand sums given above. The different lengths of the intervals do not change this basic principle. (Con-vince yourself of this.)
Trapezoidal sum=12(897.5+1012.5)=955
Exercise 2.
Tn=12[(y0+y1+y2+. . .+yn−1)!x+(y1+y2+y3+. . .+yn)!x] =12(y0+2y1+2y2+. . .+2yn−1+yn)!x
P R O B L E M S F O R S E C T I O N 2 6 . 1
Some of the problems in this problem set require the use of a programmable calculator or a computer. These are not highlighted in any way, but common sense should tell you that summing a couple of hundred terms is not a good use of your time. On the other hand, in order to make sure that you understand the numerical methods, some problems explicitly ask you to refrain from using a program to execute the computation.
1. Suppose we use right- and left-hand sums to approximate!b
a f (t ) dt. We partition the
interval [a,b] intonequal pieces each of length!t. LetRnbe the right-hand sum using
nsubdivisions andLnbe the left-hand sum usingnsubdivisions.
(a) Show thatRn=Ln+f (b)!t−f (a)!t.
(b) Conclude thatRn−Ln=[f (b)−f (a)]!t=[f (b)−f (a)]|b−na|.
2. (a) Find!x
1 1t dt, wherex >0.
(b) lnx can be defined to be!1x1t dt. Sketch the graph of 1/t and approximate ln 2 numerically by partitioning the interval [1, 2] into 4 equal pieces and computing L4andR4. Write out the sum long-hand, without using a calculator program. (c) Into how many equal pieces would you have to subdivide the interval [1, 2] in order
to approximate ln 2 so thatRnandLngive upper and lower bounds that differ by
no more than 0.01? Call this numberp. (d) ComputeMpandTp.
(e) Into how many equal pieces would you have to subdivide the interval [1, 3] in order to approximate ln 3 so thatRnandLngive upper and lower bounds that differ by
no more than 0.001? That differ by no more thanD? 3. Compute!e
1 lnx dxwith error less than 0.002. Try, by experimentation, to see how many subdivisions are required forMnandTnto differ by less than 0.002. How many
4. (a) Letf be the function graphed below.f is increasing and concave down.
f
x
a b
LetA=!abf (x) dx. Suppose that estimates off (x) dxare computed using the left, right, and trapezoid rules, each with the same number of subintervals. We’ll denote these estimates byLn,Rn, andTn, respectively. Put the numbersA,Ln,
Rn, andTnin ascending order. Justify your answer and explain why your answer
is independent of the value ofnused.
(b) Answer the same question as above if the graph off is the one given below.f is decreasing and concave up on [a,b].
f
x a b
5. Consider!14√x dx.
(a) Find a value ofnfor which
% % %Ln− !b a f (x) dx % % %≤0.01.
(b) Use the value ofnfrom part (a) tofindLnandRn.
(c) Is the average of the left- and right-hand sums larger than the integral, or smaller? (d) Compare your numerical approximations to the answer you get using the
Funda-mental Theorem of Calculus.
6. Approximate!01√1+x4dxwith error less than 0.01. 7. Give upper and lower bounds for!02 10
2+x5 dx such that the upper and lower bounds
differ by less than 0.01.
8. Give upper and lower bounds for!23 ln1xdxsuch that the two bounds differ from one another by less than 0.05. Explain how you know that the upper bound is indeed an upper bound and the lower bound is indeed a lower bound.
9. Consider!9 4 √1xdx.
(a) Find a value ofnfor which|Ln−Rn| ≤0.01.
(c) If you take the average of the left- and right-hand sums, will your approximation be larger than the integral, or smaller?
(d) Compare your numerical approximations to the answers you get using the Funda-mental Theorem of Calculus.
10. One of your friends is doing his mathematics homework on the run. He managed to squeeze in one problem between lunch and his expository writing class. He used his calculator tofindLn,Rn,Tn, andMnto approximate a definite integral and jotted down
the results on a napkin. They were
0.367617, 0.3211885, 0.341189, and 0.274760.
He didn’t write down the problem, nor did he record the value ofnhe used. But he did sketch the function (over the relevant interval) on the napkin; it looked like this.
f
x
He wants your help in labeling the data he recorded as a left-hand sum, a right-hand sum, a midpoint sum, and a trapezoidal sum. Which is which? Explain your answer. 11. Measurements of the width of a pond are taken every 20 yards along its length. The
measurements are: 0 yards, 60 yards, 50 yards, 70 yards, 50 yards, and 30 yards. Approximate the surface area of the pond using the Trapezoidal rule.
60 50
70 50
30
20 20 20 20 20
12. Approximate each of the following integrals with error less than 1/100.
(Note:If you look at all the questions and think about a strategy in advance, you
will only have to compute two integrals in order to answer all four questions with the desired degree of accuracy. There is no problem with being more accurate than is requested.) Briefly explain what you have done and how many subdivisions you used. (i)!01e−(12)x2dx (ii)!2 1 e−( 1 2)x2dx (iii)!2 0 e−( 1 2)x2dx (iv)!2 −2e−( 1 2)x2dx
13. Letf (x)= 3
x3+x. Letaandbbe positive constants, 0< a < b. Below are two partitions
of the interval [a,b]. One (given withw’s) partitions [a,b] into 8 equal subintervals, each of length!w; the other (given witht’s) partitions the interval into 12 equal pieces each of length!t.
wi=a+i!w, i=0, 1,. . ., 8
ti=a+i!t, i=0, 1,. . ., 12
Put the following expressions in ascending order, with“<”or“=”signs between them. (Identify the sum with the letter preceding it.)
A= 7 & i=0 f (wi)!w B= 8 & i=1 f (wi)!w C= 11 & i=0 f (ti)!t D= 12 & i=1 f (ti)!t E= " b a f (w) dw F=f (a)·(b−a)
14. Approximate!−21arctanx dxusing left- and right-hand sums to obtain an upper and lower bound for the integral with difference less than 0.05. Save time by graphing y=arctanx and using symmetry to simplify the problem.
15. The functionf (x)is decreasing and concave down on the interval [3, 5]. Suppose that you use a right-hand sum,R100, a left-hand sum,L100, a trapezoidal sum,T100, and a midpoint sum,M100, all with 100 subdivisions, to estimate!35f (x) dx. Select all of the following that must be true.
(a)L100≥R100 (b) !35f (x) dx≥T100 (c)T100≥R100 (d) T100≥M100 (e)M100≥L100 (f)T100=(L100+R100)/2
16. Suppose thatgis a differentiable function whose derivative isg"(x)= 2
x2+3. Partition
[0, 2] intonequal pieces each of length!xand letxk=k!x, wherek=0, 1,. . .,n. Put
the following expressions in ascending order (with“<”or“=”signs between them).
A= n & i=1 g(xi)!x B= n−1 & i=0 g(xi)!x C= lim n→∞ n−1 & i=0 g(xi)!x D= lim n→∞ n & i=1 g(xi)!x
17. Suppose L10<!abf (x) dx < R10 and|R10−L10|<0.01. Which of the following statementsmustbe true? Circleallsuch statements.
(a)|R10−!abf (x) dx|<0.01 (b)|T10−!abf (x) dx|<0.01 (c)|T10−!abf (x) dx|<0.005 (d)|L10−
!b
a f (x) dx|<0.005
18. Two of the following three integrals you can evaluate exactly. One you cannot, until learning integration by parts. Identify the one you cannot evaluate exactly and approx-imate it with an error under 0.05. Find exact answers for the other two integrals.
(a) !e 1 lnxxdx (b) !1 0 xex 2 dx (c)!01xexdx
26.2
SIMPSON’S RULE AND ERROR ESTIMATES
Simpson’s Rule
We began our discussion with left- and right-hand sums, sums that provide bounds for
!b
a f (x) dx iff is monotonic on [a,b]. Then we came up with the clever idea of using
the average ofLnandRnto approximate a definite integral. This led us to the trapezoidal
sum, which generally gives a much better approximation to a definite integral than either the left or right sums for the same number of subdivisions. Encouraged by our success, we might start thinking about averaging the midpoint and trapezoidal sums. An even better idea would be to take a weighted average of these two sums. This is because the midpoint rule generally gives us a betterfit than does the trapezoidal rule. In fact, analysis of numerical data indicates that the error in using the trapezoidal rule is about two times the size as that from using the midpoint rule. From the picture below this seems plausible. The weightingMn+Mn+Tn
3 =2Mn3+Tn gives us a method of approximating definite integrals known asSimpson’s rule.
xi midpoint xi+1
=
=
Error using trapezoid = Error using midpoint
tangent trapezoid The shaded area is about double the blackened area. Weighted average: weight midpoint twice as heavily as the trapezoidal sum. 2Mn + Tn 3 Simpson's rule Figure 26.11 Simpson’s rule:S2n= 2Mn+Tn 3
We call itS2nbecause we needndata points forMnand(n+1)different data points for
Tn. Sometimes it will be convenient to writeSp=2Mn3+Tn wherep=2n.
Simpson’s rule generally gives a substantiallybetter numerical estimate than either the midpoint or the trapezoidal sums. To get some appreciation for this, try it out on some integrals that you can compute exactly. Below we do this for the integral!151/x dx.
◆
EXAMPLE 26.3
CompareMn,Tn, and Simpson’s rule (the weighted average) for !51 1xdx, wheren=4, 8,
50, and 100. Note that!15x1dx=ln|x|
% % % 5 1=ln 5−ln 1=ln 5=1.60943791. . .. SOLUTION (a)n=4: M4=1.57460. . . T4=1.68333. . . Simpson’s rule=2M4+T4 3 =1.61084. . . (b)n=8: M8=1.59984. . . T8=1.62896. . . Simpson’s rule=2M8+T8 3 =1.60955. . . (c)n=50: M50=1.60918221. . . T50=1.60994957. . . Simpson’s rule=2M50+T50 3 =1.60943799. . . (d)n=100: M100=1.60937393. . . T100=1.60956589. . . Simpson’s rule=2M100+T100 3 =1.60943791. . .
◆
Like the trapezoidal sum, Simpson’s rule is a convenient tool for approximating
!b
a f (x) dx even when a formula forf is not available. For instance, the values off (x)
referred to in the discussion below could be measurements taken by a surveyor estimating the area of a plot of land or body of water.
Suppose our aim is to approximate!b
a f (x) dx. We can collect values off (x)at equally
spaced intervals and use Simpson’s rule to approximate the definite integral. Partition the interval [a,b] intonequal subintervals, each of length!x=b−na. We need to use a weighted average of the midpoint and trapezoidal sums; therefore, on each subinterval we need not only the value offat each endpoint (forTn) but also the value off in the middle (forMn).
Although we are chopping [a,b] intonequal subintervals, we will use 2n+1 values off (n+1 values forTnandnvalues forMn).
Letyk=f (xk)fork=0,. . ., 2n, wherex0,x1,x2,. . .,x2nare as indicated below.
xk=a+k '!x 2 ( fork=0.1,. . ., 2n x0 a x1 x2 x3 x4 x2n–2 x2n–1 x2n ∆x ∆x ∆x = b= for Mn for Mn . . . for Mn Figure 26.12
In the following exercise you will show that using this labeling convention, Simpson’s rule can be used to approximate the definite integral using the following formula.
Simpson’s rule: S2n= # 1 6 $ [y0+4y1+2y2+4y3+2y4+ · · · +2y2n−2+4y2n−1+y2n]!x, where!x=b−a n .
EXERCISE 26.3 In this exercise use the labeling system described above: Partition [a,b] intonequal pieces of length!x=b−na. xk=a+k # !x 2 $ fork=0, 1,. . ., 2n, where!x=b−a n Letyk=f (xk)fork=0,. . ., 2n, wherex0,x1,x2,. . .,x2n.
(a) Show that using this labeling convention Tn= # 1 2 $ (y0+2y2+2y4+2y6+ · · · +2y2n−2+y2n)!x.
(b) Show that using this labeling convention
Mn=(y1+y3+y5+y7+ · · · +y2n−1)!x.
(c) Show that using this labeling convention Simpson’s rule is given by
#
1 6
$
(y0+4y1+2y2+4y3+2y4+ · · · +2y2n−2+4y2n−1+y2n)!x.
The answer to part (c) is given at the end of the section.
Notice that because Simpson’s rule requires both the midpoint and trapezoidal rules and the relevant data points for each of these two rules are different, Simpson’s rule requires approximately double the number of data points necessary for computing eitherMnorTn
individually.
REMARKS
Simpson’s rule can be presented without reference to the trapezoidal and the midpoint sums. Instead, it can be viewed as follows. On each subinterval [xi−1,xi] approximate
the area underf by the area under the parabola passing through the three points on the graph off corresponding to the endpoints of the interval and the midpoint, or (xi−1,f (xi−1)),(xi,f (xi)), and # xi−1+xi 2 ,f # xi−1+xi 2 $$ .
xi–1 xi xi+1
A
B C D
E
Find a parabola through A, B, and C. Find another parabola through
C, D, and E.
Sum the areas under the parabolas to approximate the area under the curve.
Figure 26.13
When Simpson’s rule is applied to cubics, it will always give an exact answer, even when using 2M1+T1
3 .
Error Bounds
In Section 26.1 we used approximating sums to provide upper and lower bounds for the value of an integral. When we use Simpson’s rule we have a“good”estimate, but without getting a bound on the error involved we cannot be sure how“good”the estimate is. While we cannot expect to know the exact error in using approximating sums, it would be quite useful to get a bound on the error. Consider, for instance, Example 26.2. It would be useful to be able to approximate!02e−2x2dxusing the trapezoidal rule or Simpson’s rule, having a bound for the error but not worrying about the point of inflection.
Let’s begin by thinking about the error involved in using left- and right-hand sums.
y x 1 3 y x 1 3 y x 1 3
The steeper the slope of f the larger the error in approximating by rectangles. Figure 26.14
As illustrated in Figure 26.14, the larger|f"|is, the larger the magnitude of the error involved in approximating the area under the curve by the area of a rectangle.
When approximating the area using the trapezoidal rule or the midpoint tangent trape-zoid, the magnitude off"is not an issue; the rate thatf"is changing, (measured byf""), is a factor controlling the error.
ForLn,Rn,Tn, andMn, the largernis, the smaller the expected error. Put another
way, the smaller!xis, the smaller the expected error. Using the Mean Value Theorem, the following error bounds can be proven.
LetI=!abf (x) dx. LetLn,Rn,Tn, andMnbe left, right, trapezoidal, and midpoint
approximations ofI, respectively. Then
|Ln−I| ≤
M1(b−a)2
2n whereM1is the maximum value of|f"|on [a,b].
|Rn−I| ≤
M1(b−a)2 2n
|Tn−I| ≤
M2(b−a)3
12n2 whereM2is the maximum value of|f""|on [a,b].
|Mn−I| ≤
M2(b−a)3 24n2
You might guess that the error bound for Simpson’s rule involves ann3 and the third derivative off. In fact, Simpson’s rule is much more accurate than you might expect. It can be shown that
|S2n−I| ≤
M4(b−a)5
180(2n)4 whereM4is the maximum value of|f(4)|on [a,b]. Ifpis an even number, then
|Sp−I| ≤
M4(b−a)5 180p4 .
◆
EXAMPLE 26.4
Find upper bounds for the error involved in usingT10andM10to approximate!02e−2x2dx.SOLUTION In order to use the error estimates forT10andM10we need tofind an upper bound forf"" on [0, 2]. In Example 26.2 we computedf""(x). Iff (x)=e−2x2, then
f""(x)=4e−2x2(−1+4x2)
=4(−1+4x2)
e2x2 .
We can get a crude upper bound forf""on [0, 2] by noting that the numerator is no more than 4(−1+4·22)=4(−1+16)=15·4=60. |f""(x)| ≤ 60 e2x2 =60e −2x2 e−2x2≤1 on [−0, 2] so |f""(x)|<60.
NOTEWe haven’t foundM2, but we found a bound forM2.
|T10−I| ≤M2(b−a) 3 12n2 wherea=0,b=2,n=10, andM2<60 |T10−I|< 60·2 3 12·100 = 480 1200 =0.4
The error usingT10is guaranteed to be less than 0.4. |M10−I|< 60·2 3 24·100 = 0.4 2 =0.2
The error usingM10is guaranteed to be less than 0.2.
◆
◆
EXAMPLE 26.5
How big shouldnbe to easily guarantee thatMnapproximates !20 e−2x 2
dxto within 0.001?
SOLUTION From Example 26.4 we know that |Mn−I|< 24480n2 =20n2. We must find n such that 20
n2 <0.001. We’ll solve
20
n2 =0.001 and pick the next higher integer.
n2(0.001)=20=> n2=20,000 Thenn≈141.4. So we choosen=142.
◆
◆
EXAMPLE 26.6
Get an upper bound for the error involved in usingS10to approximate ln 3=!131x dx.SOLUTION f (x)=1x. Computef",f"",f""", andf(4). Confirm thatf(4)(x)=24
x5. On [1, 3], % % % % 24 x5 % % % %≤24. |Sp−I| ≤ M4(b−a)5 180p4 wherea=1,b=3,p=10, andM4=24. ≤24(3180−1)5 ·104 ≤1824·25 ·105<4.27×10−4≈0.00043
◆
Answers to Selected Exercises
Exercise 26.3(c) Simpson’s rule=2Mn+Tn 3 =#1 3 $ [2(y1+y3+y5+ · · · +y2n−1)!x+ # 1 2 $ (y0+2y2+2y4+2y6+ · · · +2y2n−2+y2n)!x] =[2y1+2y3+2y5+ + · · · +2y2n−1)]·!x· # 1 3 $ + [y0+2y2+2y4+2y6+ · · · +2y2n−2+y2n)] #1 2 $ !x·#13$ =[4y1+4y3+4y5+ · · · +4y2n−1)]· # 1 6 $ !x+[y0+2y2+2y4+2y6+ · · · +2y2n−2+y2n)]· # 1 6 $ ·!x =[y0+4y1+2y2+4y3+2y4+4y5+2y6+4y7+ · · · +2y2n−2+4y2n−1+y2n)]· # 1 6 $ !xP R O B L E M S F O R S E C T I O N 2 6 . 2
1. Approximate !e
1 lnx dx using Simpson’s rule withp=10. S10=2M53+T5. Find an upper bound for the error.At a certain point you’ll use the fact thate <3.
2. Approximate the following integrals using the trapezoidal rule, the midpoint rule, and Simpson’s rule for the specified number of subdivisions and compute error bounds using the formulas given in this section. Compare your answers to the exact answer.
(a) !02x2dx n=4 (b)!01x+11dx n=4
3. Approximate the following integral using the trapezoidal rule, the midpoint rule, and Simpson’s rule for the specified number of subdivisions. Look atTn,Mn, and S2n.
Compute error bounds.
" 2
1 lnx dx (a)n=4 (b)n=8 (c)n=10 4. (a) Approximate!01cos(x2) dxusingM
10. Find an upper bound for the error. (b) Approximate!01cos(x2) dxusingS
20.S20=2M103+T10. Find an upper bound for the error.
5. A surveyor is measuring the cross-sectional area of a 30-foot-wide river beneath a bridge. He measures the river’s depth every 5 feet. The data are given below.
Depth (in feet) 0.5 5ft )*+, 1.5 5ft )*+, 3 5ft )*+, 5 5ft )*+, 4 5ft )*+, 3 5ft )*+, 1 (a) Use the trapezoidal sum to approximate the cross-sectional area of the river. (b) Use Simpson’s rule to approximate the cross-sectional area of the river.