You have already used the very simple rectangle method to integrate a function. It assumes that the function has a constant value within each little interval.
area = height * width = f(x) * width
A picture of the rectangle method looks something like this:
The trapezoid method uses information from both the start and the end of each little piece to make a better estimate of the area under the curve. It assumes that the function may change linearly within each piece.
1 area = (avg. height) * width = - [f(x1) + f(x2)] * width 2
A picture of the trapezoid method looks something like this:
The idea behind Simpson's 1/3 Method is to evaluate the function at three points within each little interval, and then to calculate the area underneath a parabola fitted to those three points.
1 area = (Simpson's height) * width = - [ f(x1) + 4f(xm) + f(x2) ] * width 6
A picture of Simpson's method looks something like this:
Which method is best? Well, it depends on your criteria. There are several ways to rank them.
Because computers today are so fast, the good old rectangle method isn't as bad a choice as you might think. In order to reach some desired accuracy, one may (often) just crank up the number of intervals do a ridiculous value, without having to wait for the answer. But if your first attempts via the rectangle method do indicate that it's not going to work in some particular situation, I recommend jumping to Simpson's method.
Copyright © Michael Richmond. This work is licensed under a Creative Commons License.