You are on page 1of 11

Calc 1 Lecture Notes Section 4.

7 Page 1 of 11
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 width is simply the width of the interval and whose
height is determined at the midpoint of each interval.
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))
Picture:
Practice:
1. Compute an approximation to
1
3
2
1
4
3
x dx

using M
4
. Draw the four rectangles on the graph
above, and write out the four terms by hand.
Calc 1 Lecture Notes Section 4.7 Page 2 of 11
2. Compute an approximation to
1
3
2
1
4
3
x dx

using M
10
, M
20
, and M
40
. Use your calculator to
sum the sequences.
3. Compare the approximations and the errors they produce to the exact answer of
1 4 4 4
3 3 3 3
2
2
1
1
4
2 1 1.519 842 100
3
x dx x

.
4. Compute an approximation to
4 2
0
sin
x
dx

_

,

using M
4
and M
100
.
Calc 1 Lecture Notes Section 4.7 Page 3 of 11
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 +
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) + 2sum(seq(f( a+x *I ), I, 1, N-1, 1)) + f(b))* x/2
OR
T
n
= (f(a) + 2sum(seq(f(X), X, a+x, b-x, x)) ) + f(b))* x/2
OR
You can take the average of the left and right endpoint evaluations.
Picture:
Calc 1 Lecture Notes Section 4.7 Page 4 of 11
Practice:
7. Compute an approximation to
1
3
2
1
4
3
x dx

using T
4
. Draw the four trapezoids on the graph
above, and write out the four terms by hand.
8. Compute an approximation to
1
3
2
1
4
3
x dx

using T
10
, T
20
, and T
40
. Use your calculator to
sum the sequences.
9. Compare the approximations and the errors they produce to the exact answer of
1 4 4 4
3 3 3 3
2
2
1
1
4
2 1 1.519 842 100
3
x dx x

.
10. Compute an approximation to
4 2
0
sin
x
dx

_

,

using T
4
and T
100
.
Calc 1 Lecture Notes Section 4.7 Page 5 of 11
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:
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.
Calc 1 Lecture Notes Section 4.7 Page 6 of 11
On a TI graphing calculator:
S
n
= (f(a) + sum(seq( (4f(a+x*(2I-1)) + 2f(a+x*2I)), I, 1, N/2, 1)) - f(b))* x/3
Or
S
n
= (f(a) + sum(seq( (4f(X) + 2f(X+x)), X, a+x, b-x, 2*x)) - f(b))* x/3
Practice:
11. Compute an approximation to
1
3
2
1
4
3
x dx

using S
4
. Draw the four two parabolas on the
graph above, and write out the four terms by hand.
12. Compute an approximation to
1
3
2
1
4
3
x dx

using S
10
, S
20
, and S
40
. Use your calculator to
sum the sequences.
13. Compare the approximations and the errors they produce to the exact answer of
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 7 of 11
14. Compute an approximation to
4 2
0
sin
x
dx

_

,

using S
4
and S
100
.
Calc 1 Lecture Notes Section 4.7 Page 8 of 11
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 y-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 9 of 11


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 10 of 11
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:
15. 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
1
3
2
1
4
3
x dx

using each of the three numerical


techniques?
Calc 1 Lecture Notes Section 4.7 Page 11 of 11
16. 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

using each of the three numerical


techniques?

You might also like