Sei sulla pagina 1di 8

Calc 1 Lecture Notes Section 4.

7 Page 1 of 8
Section 4.7: Numerical Integration
Big idea: There are several techniques, each using different geometric shapes, for computing a
numerical approximation to a given definite integral. Some of those shapes are: rectangles
(Midpoint Rule), trapezoids (Trapezoidal Rule), and parabolas (Simpsons Rule).
Big skill: You should be able to calculate numerical approximations of definite integrals using
the midpoint rule, the trapezoidal rule, and Simpsons rule.
Midpoint Rule: Uses rectangles whose height is determined at the midpoint of each interval and
whose width is simply the width of the interval.
Picture:
Rule: ( ) ( )
1
b
n
n i
i
a
f x dx M f c x

, where
b a
x
n

, and
1
2
i
c a x i
_
+

,
.
On a TI graphing calculator:
M
n
= sum(seq(f( a+x (I-0.5) )*x ,I, 1, n, 1))
Or
M
n
= sum(seq(f(X) *x,X,a+x/2,b-x/2, x))
OR
Y1 = 1+(X-0.5)* x, then
M
n
= sum(seq(f( Y1 )*x ,X, 1, n, 1))
Practice:
1.
1
3
2
1
4
3
x dx

Note: the exact answer is


1 4 4 4
3 3 3 3
2
2
1
1
4
2 1 1.519 842 100
3
x dx x

Calc 1 Lecture Notes Section 4.7 Page 2 of 8


2.
4 2
0
sin
x
dx

_

,

Trapezoid Rule: Uses sideways trapezoids whose bases are vertical segments at the endpoints
of each interval and whose height is the width of each interval. Recall: the area of a trapezoid is
( )
1 2
1
2
trap
A b b h +
Picture:
Rule:
( )
( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( )
( ) ( ) ( )
0 1 1 2 1
0 1 2 1
1
1
2 2 2
2 2 2
2
2
2
b
n
a
n n
n
n n n
n
n i
i
f x dx T
f x f x f x f x f x f x
T x
x
T f x f x f x f x f x
x
T f a f x f b

+ + + 1
+ + +
1
]

+ + + + + 1
]
1
+ +
1
]

K
K
where
b a
x
n

and
i
x a x i +
.
On a TI graphing calculator:
T
n
= (f(a) + f(b))* x/2 + sum(seq(f( a+x *I )*x , I, 1, n-1, 1))
Or
T
n
= (f(a) + f(b))* x/2 + sum(seq(f(X) *x, X, a+x, b-x, x))
Or
You can take the average of the left and right endpoint evaluations.
Calc 1 Lecture Notes Section 4.7 Page 3 of 8
Practice:
1.
1
3
2
1
4
3
x dx

2.
4 2
0
sin
x
dx

_

,

Simpsons Rule: Top off pairs of intervals with a parabola, and then sum up the exact areas
under all those approximate parabolas. This technique gives exact answers for polynomials of
degree three or less.
Picture:
Calc 1 Lecture Notes Section 4.7 Page 4 of 8
Magnified view of the parabola fit to the curve on the interval [1, 1.25] using the points
( 1.000, f(1.000) ), ( 1.125, f(1.125) ), and ( 1.250, f(1.250) ). Its a pretty darn good fit, eh?
Rule:
( )
( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( )
0 1 2 3 1
/ 2
2 1 2
1
4 2 4 4
3
4 2
3
b
n
a
n n n
n
n i i
i
f x dx S
x
S f x f x f x f x f x f x
x
S f a f x f x f b

+ + + + + + 1
]
1
+ +
1
]

K
where
b a
x
n

and
i
x a x i +
.
Note: you must have an even number of intervals, since the parabolas are fit to pairs of intervals.
On a TI graphing calculator:
S
n
= (f(a) - f(b))* x/3 + sum(seq( (4f(a+x*(2I-1)) + 2f(a+x*2*I) )*x/3, I, 1, n/2, 1))
Or
S
n
= (f(a) - f(b))* x/3 + sum(seq( (4f(X) + 2f(X+x))*x/3, X, a+x, b-x, 2*x))
Practice:
1.
1
3
2
1
4
3
x dx

2.
4 2
0
sin
x
dx

_

,

Calc 1 Lecture Notes Section 4.7 Page 5 of 8


Calc 1 Lecture Notes Section 4.7 Page 6 of 8
Derivation of Simpsons Rule:
To begin, we need a formula for the parabola that passes through 3 given points. We have the
advantage that our points are uniformly separated by x in the x-direction. Also, to make the
algebra simpler, well switch to a coordinate system where the middle point lies on the x-axis, as
shown in the left-hand picture below. The parabola that actually passes through the points is
shown on the right hand side.

The equation for a parabola is:
2
y ax bx c + +
( )
( )
0
0 0 0
0
x
y c f
c f

+ +

( ) ( ) ( ) ( )
2
0
x x
y a x b x f f x
t
t + t + t
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( )
( ) ( ) ( ) ( )
( )
( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( )
( )
( ) ( )
2 2
2 2
2
2
0 0
0 0
2 2 0 2
2 0
2
2
a x b x f f x a x b x f f x
a x b x f f x a x b x f f x
a x f f x f x b x f x f x
f x f x f f x f x
a b
x
x
+ + + + +
+ + +
+ +
+

Calc 1 Lecture Notes Section 4.7 Page 7 of 8


The area under the fit parabola is:
( )
( ) ( )
( )
( ) ( )
( )
( ) ( )
( )
( ) ( ) ( )
( )
( ) ( )
( ) ( ) ( ) ( )
2
3 2
3 3 2 2
3
3
2
3 2
3 2
2
2
3
2 0
2
2 0
3
2
1
4 0
3
x
x
x
x
A ax bx c dx
a b
x x cx
a b
x x x x c x x
a
x c x
f x f x f
x f x
x
f x f f x x

+ +
_
+ +

,
+ +
+
+
+

+ +

Since we are fitting parabolas to the points x


i-2
, x
i-1
, and x
i
, for intervals of [x
i-2
, x
i
] the area under
the parabola for each double intervals is:
( ) ( ) ( ) ( )
interval 2 1
1
4
3
i i i
A f x f x f x x

+ + .
Thus,
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( )
0 1 2
2 3 4
4 5 5
2 1
0 1 2 3 1
/ 2
0 2 1 2
1
1
4
3
1
4
3
1
4
3
1
4
3
1
4 2 4 4
3
4 2
3
n
n n n
n n
n
i i n
i
S f x f x f x x
f x f x f x x
f x f x f x x
f x f x f x x
f x f x f x f x f x f x x
x
f x f x f x f x

+ +
+ + +
+ + +
+ + + +
+ + + + + + 1
]
1
+ +
1
]

K
K
Calc 1 Lecture Notes Section 4.7 Page 8 of 8
Error Bounds for Numerical Integration
Theorem 7.1: Error bounds for the midpoint and trapezoidal rules.
Let ET
n
be the error in using the (n+1)-point trapezoidal rule:
ET
n
= exact value approximate value = ( )
b
n
a
f x dx T

,
and let EM
n
be the error in using the midpoint rule:
EM
n
= exact value approximate value = ( )
b
n
a
f x dx M

,
If f (x) is continuous on [a, b] and | f (x)| K for all x [a, b], then
( )
3
2
12
n
b a
ET K
n

And
( )
3
2
24
n
b a
EM K
n

.
Theorem 7.2: Error bounds for Simpsons rule.
Let ES
n
be the error in using the (n+1)-point Simpsons rule:
ES
n
= exact value approximate value = ( )
b
n
a
f x dx S

,
If f
(4)
(x) is continuous on [a, b] and | f
(4)
(x)| L for all x [a, b], then
( )
5
4
180
n
b a
ES L
n

.
Practice:
How many intervals are needed to get an accuracy of 5 decimal places (i.e., error less
than 0.000 01) in the approximation of
2
1
1
dx
x

Potrebbero piacerti anche