Next: Error Bounds Up: Background Previous: Integration in Maple

### Trapezoidal rule and Simpson's rule

Two widely used rules for approximating areas are the trapezoidal rule and Simpson's rule. To motivate the new methods, we recall that rectangular rules approximated the function by a horizontal line in each interval. The horizontal line segment was determined by the function value at a point inside the interval. It is reasonable to expect that if we approximate the function more accurately inside each interval then a more efficient numerical scheme will follow. This is the idea behind the trapezoidal and Simpson's rules. Here the trapezoidal rule approximates the function by a suitable chosen (not necessarily horizontal) line segment. The function values at two points in the interval are used in the approximation. While Simpson's rule uses a suitably chosen parabolic shape (see Section 4.6 of the text) and uses the function values at three points.

The Maple student package 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);
```

```  > evalf(trapezoid(x^2,x=0..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));
```

Sean O Anderson
Tue Nov 7 09:45:27 EST 1995