26
Numerical Integration Lesson 3

Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Embed Size (px)

Citation preview

Page 1: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Numerical Integration

Lesson 3

Page 2: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Last Week• Defined the definite integral as limit of Riemann

sums.

The definite integral of f(t) from t = a to t = b.

LHS:

RHS:

Page 3: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Last Time• Estimate using left and right hand sums and

using area with a grid

If f(x) ≥ 0, then

represents the area underneath the curvef between x = a and x = b.

Page 4: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Example:Estimate:

I estimate about 4boxes.

Area of each box? 1

So Area = =4

Note: you have to dealwith “partial” boxes.

Page 5: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Area Below the AxisFor a general function:

TotalChange:

NOTE:Total Area=

A1+ A

2

Integral of a rate of change is the total change

Page 6: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Find the area under the graph of y =x2 on theinterval [1, 3] with n = 2 using left rectangles.

AL = 1*(1+4) = 5Is this estimate an under or over estimate?(Hint: Consider the graph of the function with

the rectangles.) This is an underestimate

Repeat the estimate with right rectangles.AR = 1*(4+9) = 13, overestimate

Find the average of the two estimates. (5+13)/2 = 9

Group work last time

Page 7: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Rectangles(review)

• How can we improve these estimates?

Estimating Integrals: Trapezoidal andSimpson’s Rule

Page 8: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

The Trapezoid Rule• The Trapezoid Rule is simply the average of

the left-hand Riemann Sum and the right-hand Riemann Sum.

• Averaging the two Riemann Sums gives anestimate that is more accurate than eithersum alone.

Page 9: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

A Trapezoid

Notice that the area of the trapezoid is the average of the areas of the left and right rectangles

Page 10: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Using SubintervalsDivide the interval into subintervals:

Then we get:

A Formula

Factor out ∆x/2:

Combine duplicate terms:

Factor out ∆x/2:

Page 11: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

A Formula: Trapezoidal Rule

Page 12: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Example

Approximate using n = 8 subintervals.∆x =  (4-0)/8 = 1/2 x0 = 0 x1 = 0.5 x2 = 1

Page 13: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Riemann Sums?Left-Hand Sum:

Right-Hand Sum:

Average: 21.5 Same as Trapezoidal rule!

Actual answer:

Page 14: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Pictures:The estimate is pretty good!

Better Approximations

• Trapezoidal uses straight lines: small linesNext highest degree would be parabolas…

Page 15: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Simpson’s RuleMmmm…

parabolas…Put a parabola across eachpair of subintervals:

So n must be even!Simpson's Rule is even more accurate than the Trapezoid Rule.

Page 16: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Simpson’s Rule Formula

Like trapezoidalrule Divide by 3

instead of 2

Interiorcoefficientsalternate:

4,2,4,2,…,4

Second from start and end

are both 4

Page 17: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

ExampleEstimate using Simpson’s Rule and n = 4.Here, ∆x = (4-0)/4 = 1.

Exact answer!

Page 18: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Simpson’s Rule: QuadraticsBecause Simpson’s rule uses parabolas,

it is exact for any quadratic (or lower) polynomial,with any choice of n.

(So use n = 2 for quadratics!)

Page 19: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Tables

• Functions may be represented as tables• With evenly spaced data, we can still

use the Trapezoid and / or Simpson’srule.

• If the number of subintervals is odd, wecan only use the Trapezoid rule.

Page 20: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Example:2–1347W(t)420–2–4t

Estimate .

Here, ∆x = ______. ∆x = 2

3 subintervals:use trapezoidal rule.

Page 21: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Example:

0807573828254500Width (ft)987654321Meas. #

Estimate surface area of a pond: Measurements across aretaken every 20 feet along the width:

First: What is ∆x? ∆x = 20 ft PictureMethod?

There are 8 subintervals, so we use Simpson’s rule.

ft2

Area:

Page 22: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Example: Follow Up

Surface area: 10,413.3 ft2

If average depth is 10 ft, and we want to start with 1 fishper 1,000 cubic feet of water, how many fish are needed?(Hint: Start by finding volume.)

Volume: (10,413.3 ft2)(10 ft) = 104,133 ft3.

We need about 104 fish.

Page 23: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Review• The Trapezoid Rule is nothing more than the

average of the left-hand and right-handRiemann Sums. It provides a more accurateapproximation of total change than either sumdoes alone.

• Simpson’s Rule is a weighted average thatresults in an even more accurateapproximation.

Page 24: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Summary• Formula for the Trapezoid rule (replaces

function with straight line segments)• Formula for Simpson’s rule (uses

parabolas, so exact for quadratics)• Approximations improve as ∆x shrinks• Generally Simpson’s rule superior to

trapezoidal• Used both from tabular data

Page 25: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Group work1. Use Trapezoidal rule and Simpson’s rule with 2subintervals to estimate the following integral:

!2

20

3+ 2(2

3)+ 4

3"# $%

= 80.

!2

30

3+ 4(2

3)+ 4

3"# $%

= 64.

Trapezoidal rule Simpson’s rule

Page 26: Numerical Integration - The Department of Mathematics at · PDF file · 2008-01-24Numerical Integration Lesson 3. ... There are 8 subintervals, so we use Simpson’s rule. ft2 Area:

Group work2. Write down the correct formula to useSimpson’s rule and 4 subintervals:

f (x)dx2

10

!

!2

3f (2)+ 4 f (4)+ 2 f (6)+ 4 f (8)+ f (10)[ ]