Docsity

Approximating Definite Integrals with Midpoint & Trapezoidal Rules - Prof. J. R. Buchanan, Study notes of Calculus

Partial preview of the text

Download Approximating Definite Integrals with Midpoint & Trapezoidal Rules - Prof. J. R. Buchanan and more Study notes Calculus in PDF only on Docsity!

Numerical Integration

MATH 161 Calculus I

J. Robert Buchanan

Department of Mathematics

Summer 2008

Motivation

Some definite integrals possess integrands for which we do not (yet) know antiderivatives. This prevents us from using the Fundamental Theorem of Calculus Part I to evaluate the definite integral. We may still estimate the definite integral using a Riemann sum.

Example ∫ (^1)

0

e−x

2 dx

Midpoint Rule

If

∆x =

b − a n

ci = a +

i −

∆x

then (^) ∫ b

a

f (x) dx ≈ Mn =

∑^ n

i= 1

f (ci )∆x.

Example

Estimate

0

e−x

2 dx using the Midpoint Rule.

n Mn Error 4 0. 748747 0. 001923 8 0. 747304 4. 8 × 10 −^4 16 0. 746944 1. 2 × 10 −^4 32 0. 746854 3. 0 × 10 −^5 64 0. 746832 8. 0 × 10 −^6 128 0. 746826 2. 0 × 10 −^6

Trapezoidal Rule

Area of a trapezoid: base times average height.

Thus if ∆x =

b − a n

and

xi = a + i∆x for i = 0 , 1 ,... , n then ∫ (^) b

a

f (x) dx ≈

f (x 0 ) + f (x 1 ) 2

∆x +

f (x 1 ) + f (x 2 ) 2

∆x

f (xn− 1 ) + f (xn) 2

∆x

= [f (x 0 ) + 2 f (x 1 ) + · · · + 2 f (xn− 1 ) + f (xn)]

∆x 2

Tn =

[

f (x 0 ) + f (xn) + 2

n∑− 1

i= 1

f (xi )

]

∆x 2

Example

Estimate

0

e−x

2 dx using the Trapezoidal Rule.

n Tn Error 4 0. 742984 0. 00384 8 0. 745866 9. 58 × 10 −^4 16 0. 746585 2. 39 × 10 −^4 32 0. 746764 6. 0 × 10 −^5 64 0. 746809 1. 5 × 10 −^5 128 0. 746820 4. 0 × 10 −^6

Example

Example Find the smallest value of n so that the error in using the Midpoint Rule and the Trapezoidal Rule to approximate ∫ (^1)

0

e−x

2 dx

is less than 10−^6.

Hint:

d^2 dx^2

e−x

= 2 ( 2 x^2 − 1 )e−x

2

Homework

Read Section 4. 7 Pages 413-415: 7–27 odd (omit Simpson’s Rule)