CHAPTER 4 SECTION 4.6 NUMERICAL INTEGRATION

Download Report

Transcript CHAPTER 4 SECTION 4.6 NUMERICAL INTEGRATION

CHAPTER 4
SECTION 4.6
NUMERICAL INTEGRATION
Theorem 4.16 The Trapezoidal
Rule
Trapezoidal Rule
• Instead of calculating
approximation rectangles
we will use trapezoids
– More accuracy
• Area of a trapezoid
a
•
x
xi
b
• Which dimension is the h?
b2
• Which is the b1 and the b2
1
A   b1  b2   h
2
h
b1
3
Averaging the areas of
the two rectangles is the
same as taking the area
of the trapezoid above
the subinterval.
2
1
0
1
2
3
1  9  1  9 3  1  3 17  1  17

T  1              3 
2 8 28 2 2 2 8  2 8

1  9 9 3 3 17 17

T  1        3 
2 8 8 2 2 8 8

1  27 
T  
2 2 

27
 6.75
4
4
Trapezoidal Rule
• Trapezoidal rule
approximates the integral
f(xi-1)
f(xi)
dx
b

a
dx
f ( x)dx   f ( x0 )  2 f ( x1 )  2 f ( x2 )  ...2 f ( xn1 )  f ( xn ) 
2
ba
where dx 
n
Approximate using the trapezoidal rule and n = 4.
2

0
1  x 3 dx
Approximate using the trapezoidal rule and n = 4.
2

1  x dx
3
x 
20 1

4
2
0

1 1
 1
3
A    f  0   2f    2f 1  2f    f  2
2 2
2
2

1
9
35 
 1  2  2 2  2
 3
4
8
8

1
 13.1330
4
 3.283 un2
Actual area:
2

0
1  x 3 dx  3.241 un2
Approximating with the Trapezoidal Rule

Use the Trapezoidal Rule to approximate

0
sin xdx
Comparetheresults for n  4 and n  8, as shown in thefigures.
Solution : Whenn  4, x   4 , and you obtain


0

sin xdx 

0
8




3

 sin  
 sin 0  2 sin  2 sin  2 sin
8
4
2
4

  1 4 2   1.896
y = sin x
1
2 2 2 0 
When n  8, x   8 , and you obtain


0
 

3

sin xdx   sin 0  2 sin  2 sin  2 sin
 2 sin
16 
8
4
8
2
 2 sin

Four subintervals

5
3
7

 2 sin
 2sin
 sin  
8
4
8


3 
 2  2 2  4 sin  4 sin
  1.974
16 
8
8 
y = sin x
1
 
Eight subintervals
Simpson's Rule
• As before, we divide
the interval into n parts
Snidly Fizbane
Simpson
– n must be even
• Instead of straight lines we
•
a
xi
draw parabolas through
each group of three consecutive points
b
– This approximates the original curve for finding
definite integral – formula shown below
b

a
dx
f ( x)dx  [ f ( x0 )  4 f ( x1 )  2 f ( x2 )  4 f ( x3 )  2 f ( x4 )
3n
 ...  2 f ( xn  2 )  4 f ( xn 1 )  f ( xn )]
Theorem 4.17 Integral of p(x)
=Ax2 + Bx + C
Theorem 4.18 Simpson's Rule
(n is even)
Approximate using Simpson's Rule.
Use Simpson's Rule to approximate. Compare the results for
n = 4 and n = 8.


0
sin xdx
Solution : Whenn  4, you have


0
sin xdx 

 


3

 sin  
 sin 0  4 sin  2 sin  4 sin
12 
4
2
4




4 2  2  2.005
12
When n  8, you have


0
sin xdx 

 


3

 2 sin
 sin 0  4 sin  2 sin  4 sin
24 
8
4
8
2
5
3
7

 4 sin
 2 sin
 4 sin
 sin  
8
4
8

 

3 
 2  2 2  8 sin  8 sin
  2.003
24 
8
8 
Theorem 4.19 Errors in the Trapezoidal
Rule and Simpson's Rule
The Approximate Error in the Trapezoidal Rule:
Determine a value n such that the Trapezoidal Rule will
approximate the value of
with an error less
than 0.01.
First find the second derivative of
The maximum of occurs at x = 0 (see the graph
below)
(Note: the 1st derivative test of
gives
, which would be at x = 0.
And at x = 0, f '' = 1
The error is thus
Thus were one to pick n ≥ 3, one would have an
error less than 0.01.
NOTE: THEY SIMPLY USED
½ (SUM OF BASES) X height
THE FORMULA FOR THE AREA OF A
TRAPAZOID!!!!!!
• John is stressed out. He's got all kinds of projects
going on, and they're all falling due around the same
time. He's trying to stay calm, but despite all of his
yoga techniques, relaxation methods, and sudden
switch to decaffeinated coffee, his nerves are still on
edge. Forget the 50-page paper due in two weeks
and the 90-minute oral presentation next Monday
morning; he still hasn't done laundry in weeks, and
his stink is beginning to turn heads. Because of all
the stress (and possibly due to his lack of bathing),
John's started to lose his hair.
• Below is a chart representing John's rate of hair loss
(in follicles per day) on various days throughout a
two-week period. Use 6 trapezoids to approximate
John's total hair loss over that traumatic 14-day
period.
You may be tempted to use the Trapezoid Rule, but
you can't use that handy formula, because not all of
the trapezoids have the same width. Between day 1
and 4, for example, the width of the approximating
trapezoid will be 3, but the next trapezoid will be 6 – 4
= 2 units wide. Therefore, you need to calculate each
trapezoid's area separately, knowing that the area of a
trapezoid is equal to one-half of the product of the
width of the trapezoid and the sum of the bases:
WHY DID THEY USE THE
TRAPAZOID RULE???!!!!