## 25.2 Simpson's Rule

In the notation of the last section the actual area under the function f in the interval between and will be

The trapezoid rule that we have described, on the other hand, gives the following proposed answer for this area

while the "midpoint rule" approximates the area as f(0)d.

This means that if we mix two parts of the midpoint rule and one part of the trapezoid rule, we will get the quadratic b term exactly right, and the leading term in the error will come from the e term which will be on the order of d4.

The rule for approsimating integrals just described is called Simpson's rule, and it takes the following form in the interval between and

Notice that in this formula f is evaluated at intervals apart. If we give the parameter a new name here, calling it h, the Simpson's rule formula in terms of h becomes

and it represents an approximation to the area under the curve defined by f in the interval from -h to h; an approximation whose error is of fourth order in h.

It is worthwhile noticing what these various rules look like when applied to a number of small subintervals in a row.

The trapezoid rule gives equal weight d to evaluations at all intermediate points, since each is the left end and the right end of one subinterval and it gets weight from each end.

The end two evaluations on the other hand are ends of only one subinterval each, and these get weight .

The midpoint rule gives equal weight to the odd numbered evaluations of d or 2h.

Simpson's rule gives weights that form the pattern 1 4 2 4 2 ... 4 1 multiplied by , since the midpoints get weight and the trapezoid rule divided by 3 accounts for the rest.

| endpoint a | midpoint first interval a + h | end first interval a + 2h | midpoint second interval a + 3h | end second interval a + 4h | etc.
Trapezoid rule terms | hf(a) | 0 | 2hf(a + 2h) | 0 | 2hf(a + 4h) | etc.
Midpoint rule terms | 0 | 2hf(a + h) | 0 | 2hf(a + 3h) | 0 | etc.
Simpson's rule terms |  |  |  |  |  | etc.

Notice that the leading term in the power series for f that produces an error in Simpson's rule is the ex4 term, and that produces an error which goes down by a factor of 16 if we divide our intervals in half.