Estimating Integrals: Trapezoidal and Simpson`s Rule

advertisement

Math 2015 Lesson 3

Estimating Integrals: Trapezoidal and Simpson’s Rule

We have defined the definite integral as the limit of left and right hand sums, and we have estimated integrals using left and right hand sums. Unfortunately, it may take a lot of subintervals to get a good estimate. We have successfully used geometry to help us calculate a few integrals exactly. (Remember that for f ( x ) ≥ 0, the integral represents the area trapped between the curve and the x -axis.) This geometric interpretation will help us find better estimates to integrals by using shapes other than rectangles to approximate the area under a curve.

Trapezoidal Rule

Below, we see an approximation to the area under a curve between a and b using just one subinterval and either a left hand or right hand sum. It’s clear that the rectangles do a very poor job:

The areas in gray, given by the formulas for the left and right rectangle sums are, respectively, smaller and larger than the true areas under the curve by more than half the true area, a relative error of more than 50% in each case. It turns out that improving the accuracy by dividing a into subintervals and filling in with smaller rectangles, as done in

Section 5.2, is less efficient than first improving the fit for one basic region and then subdividing. The simplest such method is the trapezoidal rule, in which the area under the curve between a and b is approximated by a trapezoid, as in the following diagram:

12

Math 2015 Lesson 3

The area of a trapezoid is the average height times the width, or in this case:

Here, we are using one subinterval, so b – a is really just ∆ x . If we want to improve our answers even further, we can subdivide the interval into n subintervals of width ∆ x = ( b –

a )/ n , and add up the result from the trapezoidal rule on each subinterval. We will label the division points with x

0

= a , x

1

= a + ∆ x , …, x n

= b , just as with writing down the left and right hand sums:

Then the trapezoidal rule might be written down as

This is a little bit of a mess, so let’s simplify. Each term has a ∆ x /2 term, so let’s factor that out to the front:

In fact, we can do better than this! Note that each of the middle points is used twice: as the left side of one interval and the right side of another. So we don’t need to compute these separately. We finally get the following calculation for the Trapezoidal rule:

Example: Approximate

4 x 2 dx using the Trapezoidal rule with n = 8 subintervals.

0

First, we should figure out

Δ x and set up our table of values.

13

Math 2015 Lesson 3

It’s worth asking how this compares to the left and right hand sums for

0

4 x 2 dx . The left hand sum with n = 8 is while the right hand sum is

The average of the left and right hand sums is _______, which is exactly the same as the trapezoidal approximation!

This actually shouldn’t be a surprise. After all, the area of each trapezoid is just the average of the areas of the left and right hand rectangles. So what we have really found is a shortcut formula to allow us to calculate this better estimate without first calculating a left and right hand sum. (We also have a good reason to believe it is a better estimate, based on our area argument!)

It turns out that the actual value is

0

4 x

2 dx

=

64

21.3

, so the trapezoidal estimate is

3 pretty good here. (We will learn how to determine the exact value of integrals like this later in the semester.) We can see in the picture below, with trapezoids superimposed on the graph, that the approximation ought to be close; it’s hard to even tell the difference between the trapezoids and the curve itself.

15

12.5

10

7.5

5

2.5

1 2 3

Trapezoidal rule with n = 8 for

x 2 dx

0

4

When we are approximating a function using the trapezoidal rule, we are essentially replacing the function with a piecewise linear function and integrating that, as in the picture at right.

The problem is that the function may not be very well approximated by a piecewise linear function. It’s clear we could do better if we worked with higher degree curves, such as parabolas.

4

14

Math 2015 Lesson 3

Simpson’s Rule

Using higher degree curves to approximate our function leads to a second approximation technique, which is known as Simpson’s rule. To use Simpson’s rule, we choose n and calculate ∆ x as before, and find the same set of points x

0

= a , x

1

= a + ∆ x , …, x n

= b . We then use the following formula:

Simpson’s rule:

This formula looks a lot like the trapezoidal rule, except for two things:

∆ x is divided by , and

• the coefficients for the “middle” terms alternate between and , starting and ending with a in the second and next-to-last term.

It is important to note: Simpson’s rule must be used with an even number of subintervals . (This is because each parabola is actually stretched across a pair of subintervals, not a single subinterval.) Thankfully, you will get a hint if you’ve forgotten and used an odd number of subintervals: if you start with coefficient 4 in the second place, the next to the last place must have coefficient 4. (If n were odd, you would end up with a 2 instead.)

We will not give a derivation of this formula as we did for the trapezoidal rule, partly because we are not familiar with the formula for the area under a parabola.

Example: Let’s get a new estimate for

x 2 dx using Simpson’s rule with n = 8

0

4 subintervals.

So, ∆ x = ______ . And we can use our same table.

Now do the same problem with n = 4 subintervals.

15

Math 2015 Lesson 3

Do you notice something interesting about your answer compared to the actual answer we gave earlier? Why would this be true?

Tables of Data

Sometimes we may work with tables of data rather than functions described algebraically. As long as the data is evenly spaced, we can still use Simpson’s or the trapezoidal rule to estimate the integral. (We may often have to use the trapezoidal rule, because there may not be an even number of subintervals.) For data which is not evenly spaced, we could still average the left and right hand sums.

Example: Suppose the following data is known for a function W ( t ). Give the best estimate you can for

4

2

W ( t ) dt . t – 4 – 2 0 2 4

H

W ( t ) 7

INT : Be sure you know

Here, ∆ t = _______.

4 3 exactly

-1 2 what data you will be using!

NOTE: When using these rules with tables of data, your ∆ x will be determined from the given information (in some way). It is not necessary to use our ( b – a )/ n formula.

Example: To estimate the surface area of a pond, a surveyor takes measurements every 20 ft. across the width of the pond. The following data is collected: measurement # 1 2 3 4 5 6 7 8 9 width in feet 0 50 54 82 82 73 75 80 0

What is the approximate total surface area?

Before we begin, read the problem carefully and determine what ∆ x will be in this case:

∆ x =

16

Math 2015 Lesson 3

Next, we must determine an appropriate method, and do the calculations:

Follow-up Question: Suppose the pond above has an average depth of 10 feet, and we plan to start fishing season with one fish per 1,000 cubic feet of water, how many fish need to be in the pond on opening day? (Hint: Start by finding the volume of the pond.)

Summary

Today, we have

Developed a formula for the trapezoidal rule, which approximates integrals by finding the area between the curve and axis using trapezoids. (The trapezoidal rule replaces the function with straight line segments, and integrates this simpler curve.)

Used a formula to estimate an integral using Simpson’s rule, which uses parabolas to approximate the curve. (Therefore, Simpson’s rule gives the exact value of the integral of a polynomial of degree two or lower.)

• Determined that the approximations generally get better as ∆ x gets smaller.

Determined that Simpson’s rule generally gives better approximations than the trapezoidal rule, which is in turn better than the left or right hand sums.

• Used the trapezoidal and Simpson’s rule to approximate integrals from tables of values for a function.

17

Download