Next: Exercises Up: Labs and Projects for Previous: Purpose

## Background

Trapezoidal rule and Simpson's rule
The rectangular rules that we used in the last lab are very simple to understand and use, but they are not very efficient. By this, we mean that a large number of subintervals is often required to get accurate results. Two widely used rules for approximating areas are the trapezoidal rule and Simpson's rule. The Maple student pakage has commands trapezoid and simpson that implement these methods. The command syntax is very similar to the rectangular approximations. See the examples below. Note that an even number of subintervals is required for the simpson command.

  > with(student);

  > trapezoid(x^2,x=0..4,4);


  > evalf(trapezoid(x^2,x=0..4,4));


  > evalf(trapezoid(x^2,x=0..4,10));


  > simpson(x^2,x=0..4);


  > evalf(simpson(x^2,x=0..4));


  > evalf(simpson(x^2,x=0..4,10));


The trapezoidal rule uses trapezoids to approximate the area over the i-th subinterval as shown above with only two subintervals in the figure for y = x2 +1.

Since the area of a trapezoid is the width times the average of the two heights, the area of the trapezoid above the i-th subinterval is

Adding up all of the areas gives us the usual formula

for a uniform partition with N subintervals. You can think of the trapezoidal rule as the result of approximating the function by straight line segments.

The derivation of Simpson's rule is more complicated and will not be discussed here. It is described in detail in the text (Bradley and Smith pgs. 303-306). The basic idea is to fit the function f(x) with segments of parabolas. Three points are required to define a parabola, so two adjacent subintervals are used for each parabola segment. (This is why an even number of subintervals are required for Simpson's method.)

Next: Exercises Up: Labs and Projects for Previous: Purpose

Christine M Palmer
3/20/1998