Gaussian quadrature for classical orthogonal polynomials

gaussquad is a Fortran 90 module for the calculation of Gaussian quadrature rules.

An \( n \)-point quadrature rule is a set of \( n \) abscissas \(x_i\) and weights \(w_i \ge 0\) which can be used to approximate integrals according to the prescription \[ \int_a^b W(x) f(x) d x \approx \sum_{i=1}^n w_i \, f(x_i) \,, \] where \( W(x) \) is a positive semidefinite weight function. A Gaussian quadrature rule specifies \( x_i \) and \( w_i \) such that the above approximation is exact when \( f(x) \) is a polynomial of degree \( \leq 2n-1 \).

gaussquad is a simple library for calculating such quadrature rules for weight functions \( W(x) \) corresponding to classical orthogonal polynomials. It currently includes Legendre \( (W(x) = 1) \), Hermite \( (W(x) = e^{-x^2}) \) and Associated Laguerre \( (W(x) = x^{\alpha} e^{-x}) \) weight functions. More such weight functions can be very easily added: all you need to know is the three-term recurrence relation for the corresponding polynomials and the quantity \( \int_a^bW(x) dx \).

Download

Version 1.0: gaussquad.f90
Example program: testquad.f90
Example output: testquad.ref

References

G. H. Golub and J. H. Welsch, Math. Comp. 23, 221 (1969)
NIST Digital Library of Mathematical Functions, Ch. 3.5 and Ch. 18.9
John Cook's simple introduction to Gaussian Quadrature