QUADPACK is a FORTRAN 77 library for numerical integration (quadrature) of one-dimensional functions. It was included in the SLATEC Common Mathematical Library and is therefore in the public domain. The individual subprograms are also available on netlib.

The GNU Scientific Library reimplemented the QUADPACK routines in C. SciPy provides a Python interface to part of QUADPACK.

Routines

The main focus of QUADPACK is on automatic integration routines in which the user inputs the problem and an absolute or relative error tolerance and the routine attempts to perform the integration with an error no larger than that requested. There are nine such automatic routines in QUADPACK, in addition to a number of non-automatic routines. All but one of the automatic routines use adaptive quadrature.

Summary of naming scheme for automatic routines
Prefix, if present1st letter2nd letter3rd letter4th letter, if presentsuffix
D Double precisionQ QuadratureN Non-adaptive A AdaptiveG General integrand W Weight function of specified formSimple integrator S Singularities handled P Specified points of local difficulty (singularities, discontinuities …) I Infinite interval O Oscillatory weight function (cos or sin) over a finite interval F Fourier transform (cos or sin) C Cauchy principal valuebasic version E extended parameter choices
DDouble precision
QQuadrature
NNon-adaptive
AAdaptive
GGeneral integrand
WWeight function of specified form
Simple integrator
SSingularities handled
PSpecified points of local difficulty (singularities, discontinuities …)
IInfinite interval
OOscillatory weight function (cos or sin) over a finite interval
FFourier transform (cos or sin)
CCauchy principal value
basic version
Eextended parameter choices

General-purpose routines

The two general-purpose routines most suitable for use without further analysis of the integrand are QAGS for integration over a finite interval and QAGI for integration over an infinite interval. These two routines are used in GNU Octave (the quad command) and R (the integrate function).

QAGS

uses global adaptive quadrature based on 21-point Gauss–Kronrod quadrature within each subinterval, with acceleration by Peter Wynn's epsilon algorithm.

QAGI

is the only general-purpose routine for infinite intervals, and maps the infinite interval onto the semi-open interval (0,1] using a transformation then uses the same approach as QAGS, except with 15-point rather than 21-point Gauss–Kronrod quadrature. For an integral over the whole real line, the transformation used is x = ( 1 − t ) / t {\displaystyle x=(1-t)/t}: ∫ − ∞ + ∞ f ( x ) d x = ∫ 0 1 d t t 2 ( f ( 1 − t t ) + f ( − 1 − t t ) ) . {\displaystyle \int _{-\infty }^{+\infty }f(x)dx=\int _{0}^{1}{dt \over t^{2}}\left(f\left({\frac {1-t}{t}}\right)+f\left(-{\frac {1-t}{t}}\right)\right)\;.} This is not the best approach for all integrands: another transformation may be appropriate, or one might prefer to break up the original interval and use QAGI only on the infinite part.

Brief overview of the other automatic routines

QNG

simple non-adaptive integrator

QAG

simple adaptive integrator

QAGP

similar to QAGS but allows user to specify locations of internal singularities, discontinuities etc.

QAWO

integral of cos(ωx) f(x) or sin(ωx) f(x) over a finite interval

QAWF

Fourier transform

QAWS

integral of w(x) f(x) from a to b, where f is smooth and w(x) = (xa)α (bx)β logk(xa) logl(bx), with k, l = 0 or 1 and α, β > –1

QAWC

Cauchy principal value of the integral of f(x)/(xc) for user-specified c and f

See also

Further reading

  • Favati, P.; Lotti, G.; Romani, F. (1991). . ACM Transactions on Mathematical Software. 17 (2): 218–232. doi:. S2CID .
  • Cools, R.; Haegemans, A. (2003). "Algorithm 824: CUBPACK: a package for automatic cubature; framework description". ACM Transactions on Mathematical Software. 29 (3): 287–296. doi:. S2CID .