16
Section 5.7 Numerical Integration

Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Embed Size (px)

Citation preview

Page 1: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Section 5.7Numerical Integration

Page 2: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule

Riemann Sum: Trapezoidal Rule: Simpson’s Rule:

Approximation by Approximation by Approximation byconstant functions linear functions parabolas (zero degree polynomials) (1st degree polynomials) (2nd degree polynomials)

a b a b a b

Page 3: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

1

( ) n

ii

f x x

0 1 2 1( ) ( ) ( ) ......... ( ) ( )n nx f x f x f x f x f x

Riemann Sum: For a regular partition of an interval [a, b] with n subintervals, each of

width , the definite integral is approximated by:b a

xn

( )

b

af x dx

Page 4: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Trapezoidal Rule: For a regular partition of an interval [a, b] with n subintervals, each of

width , the definite integral is approximated by:b a

xn

( )

b

af x dx

Page 5: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Trapezoidal Rule: For a regular partition of an interval [a, b] with n subintervals, each of

width , the definite integral is approximated by:b a

xn

( )

b

af x dx

11

1 ( ) ( )

2

n

i ii

f x f x x

Page 6: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Trapezoidal Rule: For a regular partition of an interval [a, b] with n subintervals, each of

width , the definite integral is approximated by:b a

xn

( )

b

af x dx

0 1 1 2 2 1 1( ) ( ) ( ) ( ) ( ) ......... ( ) ( ) ( )2 n n n

xf x f x f x f x f x f x f x f x

11

1 ( ) ( )

2

n

i ii

f x f x x

Page 7: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

11

1 ( ) ( )

2

n

i ii

f x f x x

0 1 1 2 2 1 1( ) ( ) ( ) ( ) ( ) ......... ( ) ( ) ( )2 n n n

xf x f x f x f x f x f x f x f x

0 1 2 1( ) 2 ( ) 2 ( ) ......... 2 ( ) ( )2 n n

xf x f x f x f x f x

Trapezoidal Rule: For a regular partition of an interval [a, b] with n subintervals, each of

width , the definite integral is approximated by:b a

xn

( )

b

af x dx

Page 8: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Ex. 1: Use the trapezoidal rule to approximate the definite

integral with n = 6. 3 3

0 x dx

Page 9: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Simpson’s Rule: For a regular partition of an interval [a, b] with n subintervals, each of

width , the definite integral is approximated by:

0 1 2 3 4 1( ) 4 ( ) 2 ( ) 4 ( ) 2 ( ) .......... 4 ( ) ( )3 n n

xf x f x f x f x f x f x f x

b ax

n

( )

b

af x dx

Page 10: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Simpson’s Rule: For a regular partition of an interval [a, b] with n subintervals, each of

width , the definite integral is approximated by:

Note: n must be an even integer.

b ax

n

( )

b

af x dx

0 1 2 3 4 1( ) 4 ( ) 2 ( ) 4 ( ) 2 ( ) .......... 4 ( ) ( )3 n n

xf x f x f x f x f x f x f x

Page 11: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Ex. 2: Use Simpson’s Rule to approximate the definite integral

with n = 6. 5

3

1 dx

x

Page 12: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Comparing the trapezoidal rule and Simpson’s rule:

Note that the formulas are very similar in construction and differ mainly in the coefficients used in the summation:

Simpson’s Rule is usually much more accurate.

Your calculator’s fnInt feature uses a method known as Gaussian Quadrature that is more accurate and dependable than either the Trapezoidal Rule or Simpson’s Rule for problems where the function to be integrated is known.

( )b

af x dx 0 1 2 3 4 12 2 2 2 ... 2

2 n n

xf x f x f x f x f x f x f x

0 1 2 3 4 14 2 4 2 ... 43 n n

xf x f x f x f x f x f x f x

( )

b

af x dx

Page 13: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Ex. 3: Use the trapezoidal rule to approximate the definite integral of the function y = f(x) over the interval [2, 5] when the function values are as given in the table. 2.0 2.75 3.5 4.25 5.0

15.2 17.1 18.6 19.2 20.4

x

y

Page 14: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Ex. 4: A town wants to drain and fill a small polluted swamp. The swamp averages 5 ft. deep. About how many cubic yards of dirt will it take to fill the area after the swamp is drained? (Use Simpson’s Rule.)

Note that the restriction for Simpson’s Rule that requires an even number of subintervals is equivalent to requiring an odd number of measurements of the function.

Page 15: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Ex. 4: The swamp averages 5 ft. deep.

Page 16: Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s

Question: Use the Trapezoidal Rule and Simpson’s Rule to

estimate using n = 8.

Solution:Trapezoidal Rule:

≈ 1.103210678

Simpson’s Rule:

≈ 1.098725349

The actual answer is ln 3 ≈ 1.098612289, so Simpson’s Rule was far more accurate.

3

1

1dx

x

21 1 1 1 1 1 1 1 18 2 2 2 2 2 2 2

2 1 1.25 1.5 1.75 2 2.25 2.5 2.75 3

21 1 1 1 1 1 1 1 18 4 2 4 2 4 2 4

3 1 1.25 1.5 1.75 2 2.25 2.5 2.75 3