You are on page 1of 14

5.

5 Numerical Integration
Mt. Shasta, California
Photo by Vickie Kelly, 1998

Greg Kelly, Hanford High School, Richland, Washington

Using integrals to find area works extremely well as long


as we can find the antiderivative of the function.
Sometimes, the function is too complicated to find the
antiderivative.
At other times, we dont even have a function, but only
measurements taken from real life.
What we need is an efficient method to estimate area
when we can not find the antiderivative.

1 2
y x 1
8

0 x4

Actual area under curve:

1 2
x 1 dx
8
4

1 3
A
x x
24
0
20
A
6.6
3

1 2
y x 1
8

0 x4

Left-hand rectangular
approximation:

1
8

1
2

1
8

3
4

Approximate area: 1 1 1 2 5 5.75

(too low)

1 2
y x 1
8

0 x4

Right-hand rectangular
approximation:

1
8

1
2

1
8

3
4

Approximate area: 1 1 2 3 7 7.75

(too high)

Averaging the two:

7.75 5.75
6.75
2

1.25% error

(too high)

Averaging right and left rectangles gives us trapezoids:

1
9
1 9 3
T 1

2
8
2 8 2

1 17
1 3 17

3
2 8
2 2 8

1
9
1 17
1 9 3 1 3 17
T 1

3
2
8
2 8
2 8 2 2 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

(still too high)

Trapezoidal Rule:

h
T y0 2 y1 2 y2 ... 2 yn 1 yn
2
( h = width of subinterval )

This gives us a better approximation than either left


or right rectangles.

1 2
y x 1
8

0 x4

Compare this with the


Midpoint Rule:
1.03125

Approximate area: 6.625

1.28125

1.78125

2.53125

0.625% error (too low)

The midpoint rule gives a closer approximation than the


trapezoidal rule, but in the opposite direction.

Trapezoidal Rule:

6.750 1.25% error

(too high)

Midpoint Rule:

6.625 0.625% error

(too low)

Notice that the trapezoidal rule gives us an answer that


has twice as much error as the midpoint rule, but in the
opposite direction.
If we use a weighted average:

Ahhh!

2 6.625 6.750
6.6
3

Oooh!

Wow!

This is the
exact answer!

This weighted approximation gives us a closer approximation


than the midpoint or trapezoidal rules.
Midpoint:

M 2h y1 2h y3 2h y1 y3
Trapezoidal:

T
h x h x
1
2

h x h x
3
4

2M T
3
1
4h y1 y3 h y0 2 y2 y4
3
twice midpoint

trapezoidal

1
1
y

y
2
h

0 2
y2 y4 2h
2
2

T h y0 y 2 h y 2 y 4
T h y0 2 y 2 y 4
h
4 y1 4 y3 y0 2 y2 y4
3
h
y0 4 y1 2 y2 4 y3 y4
3

Simpsons Rule:

h
S y0 4 y1 2 y2 4 y3 ... 2 yn 2 4 yn 1 yn
3
( h = width of subinterval, n must be even )
Example: y 1 x 2 1
8

1
9
3
17
S 1 4 2 4 3
3
8
2
8
1
9
17
1 3 3
3
2
2
1
20 6.6
3

Simpsons rule can also be interpreted as fitting parabolas


to sections of the curve, which is why this example came
out exactly.
Simpsons rule will usually give a very good approximation
with relatively few subintervals.
It is especially useful when we have no equation and the
data points are determined experimentally.