Numerical Integration Methods¶
Three Numerical Integration methods are included: the Adaptive Trapezoidal method, the Adaptive Simpson method and the Romberg method.
Adaptive Trapezoidal Theory¶
The trapezoidal rule works by splitting the function to be integrated up into a number of equal chunks and for each chunk, the curve is approximated by a straight line; in effect, the curve is approximated by a number of trapezoids. The area under the curve then can be approximated by summing the area of all the trapezoids. See wiki Trapezoidal entry for the theory.
The Adaptive Trapezoidal rule takes advantage of the fact that a curve, or part of a curve, that is fairly straight (a small second derivative) needs far fewer chunks than a rapidly changing part of the curve. This rule chunks up the curve in a variable way only using more chunks where they are absolutely required. The algorithm uses a required tolerance to determine how many chunks a given part of the curve requires.
Adaptive Simpson Theory¶
The Simpson rule works in a very similar way to the Trapezoidal. However, rather than approximating the curve with a series of straight lines, it approximated the curves with a number of quadratic curves. See wiki Simpson entry and wiki Adaptive Simpson entry for the theory.