# 14.2 "Rules" for Integrating

The goal of any integration scheme is to estimate the area in each interval of given width say $$w$$, accurately. There is no problem in doing this if the integrand is essentially constant in that interval, but if it is not, we need a plan for doing the estimation. Any such plan is called a rule for numerical integration.

Here are the simplest rules, starting from the least sensible ones.

1. Estimate the height of the interval by the value of the integrand at the interval's leftmost point. This is called the left hand rule.

2. Estimate the height of the interval by the value of the integrand at its rightmost point. This is the right hand rule.

3. Estimate the height of the interval by the average of the previous two. This is called the trapezoid rule.

4. Estimate the height of the interval by the value of the integrand smack in the middle of it. This has the disadvantage that you need to find it in the middle of the interval rather than at an end. It is sometimes called the midpoint rule.

5. Choose the combination of the previous two that is exactly satisfied by quadratic functions. This is called Simpson's Rule.

Enough! Are there more rules?

Yes, you can do even better.

Better? How well do these rules do?

Well, the first two rules have errors in them that decline linearly with $$d$$. So if you divide $$d$$ by two, the error decreases by a factor of $$2$$ as well.

The next two have errors that are quadratic in $$d$$; this means that they decline by a factor of $$4$$ when $$d$$ decreases by a factor of $$2$$.

Simpson's rule has an error which is quartic in $$d$$; it declines by a factor of $$16$$ as $$d$$ decreases by a factor of $$2$$; and you can achieve a decline by a factor of $$64$$ if you want, or even more.

The trapezoid rule uses as height of each interval half the value at each end. This gives a weight of $$\frac{1}{2}$$ to the endpoints of integration, and $$\frac{2}{2}$$ to each intermediate point, ($$\frac{1}{2}$$ from the interval on each side of it).

Simpsons rule amounts to doubling the contribution from the odd numbered points but then using $$3$$ as the denominator instead of $$2$$; so the first and last points (the last being necessarily even) get weight $$\frac{1}{3}$$, the odd ones get weight $$\frac{4}{3}$$ and the other even ones get weight $$\frac{2}{3}$$.

And are these rules hard to apply?

No, the first three are very easy, and you can get Simpson's by a clever trick from the third. With another similar trick you can get the super Simpson rule with a factor $$64$$ error decline for each decrease of $$d$$ to $$\frac{d}{2}$$.

So how accurate can you get with such integrations?

For most integrands, over finite intervals you should be able to get ten place accuracy, if you want it, which is far more than any problem you encounter will need.

OK, you got me curious. Why does the trapezoid rule do better than the first two? And why is Simpson's Rule still better?