Adaptive QuadratureIf an integrand is poorly behaved in a small interval about a point, then an attempt to integrate the function over an interval which contains the poorly behaved interval either requires that small subintervals are chosen for composite quadratures or the interval is decomposed into three intervals, two on which the function is well-behaved and relatively large subintervals can be chosen for the composite quadrature technique and one in which smaller subintervals need to be chosen. Adaptive techniques are attempts to automatically detect and control the length of subintervals.
The technique for which the link to the listing is given below uses Simpson's rule for integrating a function f(x) on a closed and bounded interval [a,b].
- double Simpson_Simpson_Adaptive( double a, double b, double tolerance, double (*f)(double), double min_h, int *err )
Integrate, using the Simpson-Simpson adaptive method, the user supplied function (*f)(x) from a to b where a is the lower limit of integration, b > a is the upper limit of integration, tolerance is the tolerance, min_h is the minimum subinterval length to be used, and err is set to 0 if iteration was successful and -1 if not, and -2 if a memory request failed.
C Source Code
- The file, simpson_simpson.c, contains the version of Simpson_Simpson_Adaptive( ) written in C.