Adaptive quadrature
This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. (August 2019) (Learn how and when to remove this template message) |
Adaptive quadrature is a numerical integration method in which the integral of a function [math]\displaystyle{ f(x) }[/math] is approximated using static quadrature rules on adaptively refined subintervals of the region of integration. Generally, adaptive algorithms are just as efficient and effective as traditional algorithms for "well behaved" integrands, but are also effective for "badly behaved" integrands for which traditional algorithms may fail.
General scheme
Adaptive quadrature follows the general scheme
1. procedure integrate ( f, a, b, τ ) 2. [math]\displaystyle{ Q \approx \int_a^b f(x)\,\mathrm{d}x }[/math] 3. [math]\displaystyle{ \varepsilon \approx \left|Q - \int_a^b f(x)\,\mathrm{d}x\right| }[/math] 4. if ε > τ then 5. m = (a + b) / 2 6. Q = integrate(f, a, m, τ/2) + integrate(f, m, b, τ/2) 7. endif 8. return Q
An approximation [math]\displaystyle{ Q }[/math] to the integral of [math]\displaystyle{ f(x) }[/math] over the interval [math]\displaystyle{ [a,b] }[/math] is computed (line 2), as well as an error estimate [math]\displaystyle{ \varepsilon }[/math] (line 3). If the estimated error is larger than the required tolerance [math]\displaystyle{ \tau }[/math](line 4), the interval is subdivided (line 5) and the quadrature is applied on both halves separately (line 6). Either the initial estimate or the sum of the recursively computed halves is returned (line 7).
The important components are the quadrature rule itself
- [math]\displaystyle{ Q \approx \int_a^bf(x)\,\mathrm{d}x , }[/math]
the error estimator
- [math]\displaystyle{ \varepsilon \approx \left|Q - \int_a^bf(x)\,\mathrm{d}x\right| , }[/math]
and the logic for deciding which interval to subdivide, and when to terminate.
There are several variants of this scheme. The most common will be discussed later.
Basic rules
The quadrature rules generally have the form
- [math]\displaystyle{ Q_n \quad = \quad \sum_{i=0}^n w_if(x_i) \quad \approx \quad \int_a^b f(x)\,\mathrm{d}x }[/math]
where the nodes [math]\displaystyle{ x_i }[/math] and weights [math]\displaystyle{ w_i }[/math] are generally precomputed.
In the simplest case, Newton–Cotes formulas of even degree are used, where the nodes [math]\displaystyle{ x_i }[/math] are evenly spaced in the interval:
- [math]\displaystyle{ x_i = a + \frac{b - a}{n} i. }[/math]
When such rules are used, the points at which [math]\displaystyle{ f(x) }[/math] has been evaluated can be re-used upon recursion:
A similar strategy is used with Clenshaw–Curtis quadrature, where the nodes are chosen as
- [math]\displaystyle{ x_i = \cos\left( \frac{2i}{n}\pi \right). }[/math]
Or, when Fejér quadrature is used,
- [math]\displaystyle{ x_i = \cos\left( \frac{2(i+0.5)}{n+1}\pi \right). }[/math]
Other quadrature rules, such as Gaussian quadrature or Gauss-Kronrod quadrature, may also be used.
An algorithm may elect to use different quadrature methods on different subintervals, for example using a high-order method only where the integrand is smooth.
Error estimation
Some quadrature algorithms generate a sequence of results which should approach the correct value. Otherwise one can use a "null rule" which has the form of the above quadrature rule, but whose value would be zero for a simple integrand (for example, if the integrand were a polynomial of the appropriate degree).
See:
- Richardson extrapolation (see also Romberg's method)
- Null rules
- Epsilon algorithm
Subdivision logic
"Local" adaptive quadrature makes the acceptable error for a given interval proportional to the length of that interval. This criterion can be difficult to satisfy if the integrands are badly behaved at only a few points, for example with a few step discontinuities. Alternatively, one could require only that the sum of the errors on each of the subintervals be less than the user's requirement. This would be "global" adaptive quadrature. Global adaptive quadrature can be more efficient (using fewer evaluations of the integrand) but is generally more complex to program and may require more working space to record information on the current set of intervals.
See also
- Adaptive numerical differentiation
- Adaptive step size in ODE
- Adaptive Simpson's method for an example of adaptive quadrature
- QUADPACK, a FORTRAN library that uses global adaptive quadrature
Notes
References
- McKeeman, William (December 1962). Gotlieb, Calvin. ed. "Algorithm 145: Adaptive numerical integration by Simpson's rule". Communications of the ACM (New York City: ACM) 5 (12): 604–605. doi:10.1145/355580.369102. ISSN 0001-0782. OCLC 1011805770.
- John R. Rice. A Metalgorithm for Adaptive Quadrature. Journal of the ACM 22(1) pp 61-82 (January 1975).
- Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP (2007), "Section 4.7. Adaptive Quadrature", Numerical Recipes: The Art of Scientific Computing (3rd ed.), New York: Cambridge University Press, ISBN 978-0-521-88068-8, http://apps.nrbook.com/empanel/index.html?pg=194
Original source: https://en.wikipedia.org/wiki/Adaptive quadrature.
Read more |