Calculus 141, Section 8.6 The Trapezoidal Rule & Simpson's Rule

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Calculus 141, section 8.

6 The Trapezoidal Rule & Simpsons Rule


notes by Tim Pilachowski Back in Math 140, section 5.1, you did Riemann sums. The interval a x b was split up into n subintervals, ba = x . Then a series of rectangles was drawn, each with a width of x and a called partitions, of width = n height of y = f(x). In section 8.6 were only going to consider the rectangles whose height is in the middle of the intervalthe Midpoint Rule: Area under the curve f ( x1 ) x + f ( x 2 ) x + f ( x3 ) x + K f ( x n ) x ba = [ f ( x1 ) + f ( x 2 ) + f ( x3 ) + K f ( x n )] n This formula (a Riemann sum) provides an approximation to the area under the curve for functions that are nonnegative and continuous. Example A, Midpoint Rule: Approximate the area under the curve y = x on the interval 2 x 4 using n = 5 subintervals.

Recalling that area under the curve from a to b =

b a f (x ) dx , the Midpoint Rule can be used to approximate a

definite integral. Next, however, instead of rectangles, were going to create a series of trapezoids and calculate areas. Each trapezoid will still have a width of x, but will also have two heightsone to each side, left and x right, f ( xk 1 ) & f ( xk ) . The formula for the area of a trapezoid is [ f ( xk 1 ) + f ( xk )] . 2

Example A, Trapezoidal Rule: Approximate the area under the curve y = x on the interval 2 x 4 using n = 5 subintervals. That is, approximate the definite integral

x dx by the Trapezoidal Rule.

We can take this example and generalize into a Trapezoidal Rule for n subintervals:
b x x x x x x a f (x ) dx f (x0 ) 2 + 2 f (x1 ) 2 + 2 f (x2 ) 2 + 2 f (x3 ) 2 + K + 2 f (xn 1 ) 2 + f (xn ) 2

b a [ f ( x0 ) + 2 f ( x1 ) + 2 f ( x 2 ) + 2 f ( x3 ) + K + 2 f (x n 1 ) + f ( x n )] 2n
Example A, integration:

2
4

x dx .

3 4 3 3 3 4 1 2 dx = 2 x 2 = 2 4 2 2 2 = 2 8 2 2 . x dx x = 2 2 3 2 3 3 2 3 The exact value for the area under the curve y = x on the interval 2 x 4 is 8 2 which is 3 approximately 3.44771525.

The Trapezoidal Rule estimate was a little bit low. The error incurred by the Trapezoidal Rule to approximate b KT 3 T a f (x ) dx satisfies E n 12n 2 (b a ) , where KT is an upper bound value for f (x ) for a x b. Example A, Trapezoidal Rule error: Find a value for n that guarantees an error of no more than 105 in the approximation by the Trapezoidal Rule of

x dx .

Each of the first two approximation methods, Midpoint Rule and Trapezoidal Rule, were each off by a bit. Also note that, as is usually the case with functions of the type well be seeing, while one of them is a bit high (our Midpoint Rule by about 0.000688768), the other is a bit low (our Trapezoidal Rule by about 0.00137879). Simpsons Rule combines this notion into a formula which weights the two according to their relative errors: b 2M + T a f (x ) dx 3 . Example A, Simpsons Rule: Approximate the area under the curve y = x on the interval 2 x 4 using 5 subintervals. That is, approximate the definite integral

2 3.448403926 + 3.44633646 3.447714771 3 Simpsons Rule got us to within 5 decimal places.

x dx by Simpsons Rule.

x dx

It is unnecessary to calculate both Midpoint and Trapezoidal Rules before calculating Simpsons Rule. There is a comprehensive version of Simpsons Rule, which can be found by inserting the formulae for Midpoint and Trapezoidal Rules into 2 M3+T . b a [ f (x ) + 4 f (x ) + 2 f (x ) + 4 f (x ) + K + 2 f (x 0 1 2 3 n 2 ) + 4 f ( x n 1 ) + f ( x n )] 3n

In this schema for explaining Simpsons Rule, successive values for xk are alternately boundaries of subintervals (from Trapezoidal Ruleeven subscripts) and midpoints of subintervals (from Midpoint Ruleodd subscripts). [Note that for Simpsons Rule, n must be an even number.] Side note: Why do the Midpoint Rule terms have a coefficient of 4? During the substitution into
2 M +T 3

and

subsequent simplification process these terms are multiplied << times 2 in the formula, and times 2 again to get a common denominator with the Trapezoidal Rule >> . Simpsons Rule is a useful formula to know, since it is more efficient than finding Midpoint Rule and Trapezoidal Rule estimates first, then combining the two. Also, the comprehensive formula is more accurate, since rounding errors introduced in the Midpoint and Trapezoidal Rules get compounded. Example B: Approximate
x0 1

e x dx using Simpsons Rule for n = 8. x2 1.5 x3 1.75 x4 2 x5 2.25 x6 2.5 x7 2.75 x8 3

x=

x1 1.25

3 1 1 1.52 + 4 e1.752 + 2 e 22 + 4 e 2.252 + 2 e 2.52 + 4 e 2.752 + e 32 1.252 e + 4 e + 2e 3 (8) which is approximately 1475.429234.

Note the very steep slope of the function y = e x when x > 1. At x = 3, e 3 = e 9 8103.08 , so an area under the curve of 1475.43 makes sense. Quick side note: I have given an explanation of Simpsons Rule based on a combination of Midpoint and Trapezoidal Rules. The explanation given by the text is based on approximation using parabolas. Are they the same mathematically? Yes, but there isnt time to go into the details. The mathematics would be based on finding the equation of a suitable parabola given three points: two endpoints from the Trapezoidal Rule and the midpoint from the Midpoint Rule. Also, while the explanations used strictly non-negative functions, the beauty of Simpsons Rule is that it applies to all continuous functions, whether or not they are non-negative. The error incurred by the Simpsons Rule to approximate is an upper bound value for f (4 ) ( x ) for a x b. approximation by the Simpsons Rule of
f (x ) = x
1 2,

b KS 5 S a f (x ) dx satisfies En 180n 4 (b a ) , where KS

Example A Simpsons Rule error: Find a value for n that guarantees an error of no more than 105 in the

x dx . f (3) ( x ) =

15 7 2 15 = x 16 16 x 7 15 15 = KS . On the interval [2, 4] the upper bound of the second derivative is f (4 ) (2) = 7 128 2 16 2
f (x ) =
S En

1 12 , x 2

1 3 f ( x ) = x 2 , 4

3 52 , x 8

f (4 ) ( x ) =

(128 2 )(180n 4 )

15

(4 2)5 =

15 720n 4 2
15 10 5

Choose n so that

15 720n 4 2

10 5

720 2

( ) n4

15 10 5 n 4 6 .2 n = 7 . 720 2

( )

Example C: Approximate

x dx , using Midpoint Rule (4 subintervals), Trapezoidal Rule (4 subintervals) x 1

and Simpsons Rule (n = 8). Midpoint Rule with 4 subintervals, values of xk are midpoints of subintervals x f(x) x1 2.25 2.25 9 = 1.25 5 x2 2.75 2.75 11 = 1.75 7 x3 3.25 3.25 13 = 2.25 9 x4 3.75 3.75 15 = 2.75 11

4 2 9 11 13 15 1 9 11 13 15 + + + = + + + 4 2 5 7 9 11 5 7 9 11

3.08975469

Trapezoidal Rule with 4 subintervals, values of xk are endpoints of subintervals


x f ( x) x0 2 2 x1 2.5 2.5 5 = 1.5 3 x2 3 3 2 x3 3.5 3.5 7 = 2.5 5 x4 4 4 3

42 14 4 5 3 7 4 1 10 2 + 2 + 2 + 2 + = 2 + + 3 + + 3.11666667 2 (4) 3 5 3 3 2 5 3 4 Simpsons Rule, values of xk include both endpoints and midpoints from above, n = 8
x f ( x) x0 2 2 x1 2.25 2.25 9 = 1.25 5 x2 2.5 2.5 5 = 1.5 3 x3 2.75 2.75 11 = 1.75 7 x4 3 3 2 x5 3.25 3.25 13 = 2.25 9 x6 3.5 3.5 7 = 2.5 5 x7 3.75 3.75 15 = 2.75 11 x8 4 4 3

9 5 11 3 13 7 15 4 4 2 2 + 4 + 2 + 4 + 2 + 4 + 2 + 4 + 3 (8) 5 3 7 2 9 5 11 3 1 36 10 44 52 14 60 4 = 2 + + + + 3 + + + + 3.09872535 12 5 3 7 9 5 11 3

By the way, this integral may look like one could use integration by parts. However, its notno matter how you try to define u and dv, you get an even messier integral to deal with. (There are other methods of integration we wont be using in this class.)

You might also like