Docsity

Approximating Definite Integrals using Riemann Sums and Other Methods, Study notes of Calculus

Toggle sidebar
bg1
Jim Lambers
Math 2B
Fall Quarter 2004-05
Leture 23 Notes
These notes orrespond to Setion 8.7 in the text.
Approximate Integration
The Fundamental Theorem of Calulus provides a simple metho d for evaluating many denite
integrals of the form
Z
b
a
f
(
x
)
dx:
(1)
However, the theorem an only be used under the following onditions:
The integrand
f
(
x
) must be a known ontinuous funtion. This is not always the ase, sine
knowledge of
f
(
x
) may be limited to a small set of values at spei
sampling points
in the
interval [
a; b
℄, where suh values are typially obtained from measurements.
Ev
en if a formula for
f
(
x
) is known, we must still be able to anti-dierentiate
f
(
x
). If no
antiderivative is known, then we annot apply the Fundamental Theorem of Calulus.
In real appliations, integrals for whih the Fundamental Theorem of Calulus is of no use arise
quite frequently. Suh integrals annot be evaluated exatly, and therefore we must approximate
their values instead. This leads to the study of
numeri
al integration
, whih is also known as
numerial quadr
ature
.
Riemann Sums
Sine the denite integral is dened to be the limit of a sequene of Riemann sums, ertainly any
valid Riemann sum an be used to approximate the value of the integral. we have already used a
few partiular types of Riemann sums to obtain suh an approximation:
W
e an divide the interval [
a; b
℄ into
n
subintervals of equal width
x
= (
b
a
)
=n
, and
approximate the area under the graph of
f
by adding the areas of
n
retangles of width
x
and height determined by the value of
f
(
x
) at the
left endpoint
of eah subinterval. The
resulting Riemann sum is
Z
b
a
f
(
x
)
dx
n
X
i
=1
f
(
x
i
1
)
x; x
i
=
a
+
i
x:
(2)
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Approximating Definite Integrals using Riemann Sums and Other Methods and more Study notes Calculus in PDF only on Docsity!

Jim Lamb ers

Math 2B

Fall Quarter 2004-

Le ture 23 Notes

These notes orresp ond to Se tion 8.7 in the text.

Approximate Integration

The Fundamental Theorem of Cal ulus provides a simple metho d for evaluating many de nite

integrals of the form

Z

b

a

f (x) dx: (1)

However, the theorem an only b e used under the following onditions:

 The integrand f (x) must b e a known ontinuous fun tion. This is not always the ase, sin e

knowledge of f (x) may b e limited to a small set of values at sp e i sampling points in the

interval [a; b℄, where su h values are typi ally obtained from measurements.

 Even if a formula for f (x) is known, we must still b e able to anti-di erentiate f (x). If no

antiderivative is known, then we annot apply the Fundamental Theorem of Cal ulus.

In real appli ations, integrals for whi h the Fundamental Theorem of Cal ulus is of no use arise

quite frequently. Su h integrals annot b e evaluated exa tly, and therefore we must approximate

their values instead. This leads to the study of numeri al integration, whi h is also known as

numeri al quadrature.

Riemann Sums

Sin e the de nite integral is de ned to b e the limit of a sequen e of Riemann sums, ertainly any

valid Riemann sum an b e used to approximate the value of the integral. we have already used a

few parti ular typ es of Riemann sums to obtain su h an approximation:

 We an divide the interval [a; b℄ into n subintervals of equal width x = (b a)=n, and

approximate the area under the graph of f by adding the areas of n re tangles of width x

and height determined by the value of f (x) at the left endpoint of ea h subinterval. The

resulting Riemann sum is

Z

b

a

f (x) dx 

n X

i=

f (x i 1 )x; x i = a + ix: (2)

 Similarly, we an determine the height of ea h re tangle using the right endpoint of ea h

subinterval, resulting in the approximation

Z

b

a

f (x) dx 

n X

i=

f (x i

)x: (3)

 We have seen that a more a urate approximation an b e obtained by setting the height of

ea h re tangle equal to the value of f (x) at the midpoint of the orresp onding subinterval.

The resulting approximation is known as the Midpoint Rule:

Z

b

a

f (x) dx 

n X

i=

f (x i 1 = 2

)x; x i 1 = 2

x i 1

  • x i

In addition, we an approximate the integral by averaging the approximations obtained by using

left endp oints and right endp oints. The resulting rule, alled the Trapezoidal Rule, e e tively

approximates the area under the graph of f by n trap ezoids of width x and heights f (x i 1

) and

f (x i ), for i = 1 ; : : : ; n.

Intuitively, it makes sense that an approximation using trap ezoids is more a urate than using

re tangles. This is true in that the Trap ezoidal Rule is far more a urate than using left or

right endp oints. In fa t, not only is it more a urate, but the approximation obtained using

the Trap ezoidal Rule onverges to the exa t value of the integral at a mu h faster rate than the

approximation obtained using left or right endp oints. Sp e i ally, the error in the approximation

by left or right endp oints de reases by a fa tor of 2 when the numb er of re tangles is doubled.

In other words, the error is prop ortional to x, and therefore we say that these approximations

onverge linearly to the exa t value as n, the numb er of re tangles, tends to 1.

The error in the Trap ezoidal Rule, however, de reases by a fa tor of 4 when the numb er of

re tangles is doubled. It follows that the error is prop ortional to x

, and therefore we say that

the approximation obtained using the Trap ezoidal Rule onverges quadrati al ly to the exa t value

as n, the numb er of trap ezoids, tends to 1.

Surprisingly, it turns out that the Midp oint Rule, even though it approximates the area using

re tangles, is even more a urate than the Trap ezoidal Rule. Its approximations onverge quadrat-

i ally to the exa t value, and the error with n re tangles is approximately half of the error of the

Trap ezoidal Rule using n trap ezoids. The reason for this greater a ura y an b e seen by examining

a parti ular subinterval [x i 1

; x i

℄ of [a; b℄. Let x M

b e the midp oint of this subinterval. Then the

area of the re tangle of height f (x M

) and width x is equal to the area of the trap ezoid whose

upp er side is tangent to the graph of f at x M

, sin e su h a trap ezoid, by the equation of the tangent

line, would have heights f (x M ) f

(x M )x= 2 and f (x M ) + f

(x M )x=2. The fa t that the upp er

side of this trap ezoid is tangent to the graph of f allows this side to more losely approximate the

graph of f on this subinterval than the line passing through f (x i 1 ) and f (x i ), whi h is the upp er

side of the trap ezoid used by the Trap ezoidal Rule.

Example 1 The following table des rib es a fun tion r (t) that indi ates the rate of snowfall at time

t, where t is measured in hours sin e some initial time.

t 0 1/2 1 3/2 2 5/2 3

r (t) 0.7 1.2 2.3 1.7 1.1 0.5 0.

Estimate the total snowfall over the three-hour p erio d for whi h data has b een gathered.

Solution We will estimate the total snowfall, whi h is given by the de nite integral

Z

r (t) dt; (7)

using ve di erent metho ds: left endp oints, right endp oints, the Midp oint Rule, the Trap ezoidal

Rule, and Simpson's Rule.

  1. Left endp oints: the integral an b e interpreted not only as total snowfall, but also the area

under the urve y = r (t) from t = 0 to t = 3. This area an b e estimated by approximating

the region under the urve by six re tangles that are determined as follows: the interval [0; 3℄

is divided into six subintervals of equal with t = (3 0)= 6 = 1 =2. Ea h subinterval has

endp oints [t i 1

; t i

℄ where t i

= it for i = 0 ; : : : ; 6. Then, we have

Z

r (t) dt =

X

i=

Z

t i

t i 1

r (t) dt; (8)

and ea h integral in the ab ove sum an b e approximated as follows:

Z

t i

t i 1

r (t) dt  r (t i 1

)(t i 1

t i

) = r (t i 1

)t: (9)

In other words, the integral of the subinterval [t i 1 ; t i ℄ is approximated by omputing the

area of a re tangle with width t and height equal to the value of r (t) at the left endp oint

of the subinterval. Sin e there are 6 subintervals, ea h of width 1 =2, it follows that the

approximation L 6

to the total snowfall obtained using left endp oints is given by

L

X

i=

r (t i 1 )t

X

i=

r ((i 1)t)t

X

i=

r ((i 1)=2)= 2

[r (0) + r (1=2) + r (1) + r (3=2) + r (2) + r (3=2)℄

[0: 7 + 1 : 2 + 2 : 3 + 1 : 7 + 1 : 1 + 0 :5℄

The approximating re tangles are shown in Figure 1.

0 0.5 1 1.5 2 2.5 3

0

1

2

t

r(t)

Left endpoints

Figure 1: Approximating re tangles from using left endp oints

  1. Right endp oints: we pro eed exa tly as with left endp oints, but this time we approximate

the integral over ea h subinterval by the area of a re tangle whose height is obtained by

evaluating r (t) at the right endp oint, t i , of ea h subinterval [t i 1 ; t i ℄. The approximation R 6

0 0.5 1 1.5 2 2.5 3

0

1

2

t

r(t)

Right endpoints

Figure 2: Approximating re tangles from using right endp oints

width t and heights r (t M ) + (t=2)r

(t M ) and r (t M ) (t=2)r

(t M ), where t M = (t i 1

  • t i

is the midp oint of the subinterval. Of ourse, we do not know r

(t M

), but we an approximate

it using the nite di eren e

r

(t M

r (t i

) r (t i 1

t

The approximating trap ezoids are shown in Figure 4.

  1. Trap ezoidal Rule: The interval [0; 3℄ is on e again divided into six subintervals of equal width

t = 1 =2. On ea h subinterval [t i 1

; t i

℄, the region under y = r (t) is approximated by a

trap ezoid of width t and heights determined by the value of r (t) at the left endp oint t i 1

and at the right endp oint t i

. The approximation T 6

obtained using this approa h is

T

X

i=

t

r (t i 1 ) + r (t i

0 0.5 1 1.5 2 2.5 3

0

1

2

t

r(t)

Midpoints

Figure 3: Approximating re tangles from Midp oint Rule

t

X

i=

r (t i 1

) + r (t i

t

[(r (t 0

) + r (t 1

)) + (r (t 1

) + r (t 2

)) + (r (t 2

) + r (t 3

(r (t 3

) + r (t 4

)) + (r (t 4

) + r (t 5

)) + (r (t 5

) + r (t 6

t

[r (t 0 ) + 2 r (t 1 ) + 2 r (t 2 ) + 2 r (t 3 ) + 2 r (t 4 ) + 2 r (t 5 ) + r (t 6

[ 0 : 7 + 2(1:2) + 2(2:3) + 2(1:7) + 2(1:1) + 2(0:5) + 0 :2℄

[ 0 : 7 + 2 : 4 + 4 : 6 + 3 : 4 + 2 : 2 + 1 + 0 :2℄

0 0.5 1 1.5 2 2.5 3

0

1

2

t

r(t)

Trapezoidal Rule

Figure 5: Trap ezoidal Rule

The approximating quadrati fun tions are shown in Figure 6. Note that on the third and

fourth subintervals, the quadrati approximation is a tually a linear fun tion, sin e the p oints

(1; 2 :3), (3= 2 ; 1 :7), and (2; 1 :1) all lie on the same line.

Example 2 Approximate the integral

Z

x

dx (16)

using the following metho ds:

  1. Left endp oints with 3 and 6 subintervals,

0 0.5 1 1.5 2 2.5 3

0

1

2

t

r(t)

Simpson’s Rule

Figure 6: Approximating quadrati fun tions from Simpson's Rule

  1. Right endp oints with 3 and 6 subintervals,
  2. The Midp oint Rule with 3 and 6 subintervals,
  3. The Trap ezoidal Rule with 3 and 6 subintervals,
  4. Simpson's Rule with 2 and 4 subintervals.

Compare to the exa t answer

Z

x

dx =

x

Solution In the ase of 3 subintervals, we have width x = (3 0)= 3 = 1, and for 6 subintervals,

we have x = (3 0)= 2 = 1 =2.

  1. Left endp oints: We have

L

= x

x

  • x
  • x

and

T

x

x

  • 2 x
  • 2 x
  • 2 x
  • 2 x
  • 2 x
  • x
  1. Simpson's Rule: We have

S

x

x

  • 4 x
  • x

[0 + 9 + 9℄ = 9 (26)

and

S

x

x

  • 4 x
  • 2 x
  • 4 x
  • x

Be ause Simpson's Rule approximates the integrand by a quadrati fun tion on ea h pair of subin-

tervals, and the integrand is a quadrati fun tion, its approximation is exa t no matter how few

subintervals are used.

The following table summarizes the error of the other approximations. In all ases the error is

obtained by taking the absolute value of the di eren e b etween the approximation and the exa t

answer of 9.

Rule Error, n = 3 Error, n = 6

Left endp oints 4 2.

Right endp oints 5 2.

Midp oint Rule 0.25 0.

Trap ezoidal Rule 0.5 0.

We make the following observations:

 The Midp oint Rule is the most a urate, followed by the Trap ezoidal Rule. Both of these

rules are mu h more a urate than using either left or right endp oints.

 For the Midp oint Rule and the Trap ezoidal Rule, the error is redu ed by a fa tor of 4 when

the numb er of subintervals is doubled.

 When using the left or right endp oints, the error is redu ed by a fa tor of only 2 when the

numb er of subintervals is doubled.