Gaussian quadrature

Gaussian quadrature is a powerful numerical integration technique designed to achieve high accuracy using a carefully chosen set of sample points and weights. Unlike basic methods of numerical integration, such as the trapezoidal or Simpson’s rule, which use equally spaced points, Gaussian quadrature selects both the locations of the points and their associated weights in an optimized way. This flexibility allows Gaussian quadrature to approximate integrals with fewer evaluations, often with remarkably high precision.

The key idea behind Gaussian quadrature is to approximate the integral of a function over an interval by summing the function’s values at specific points , each multiplied by a weight . For an integral of the form: , Gaussian quadrature approximates it as:

where is the number of points used in the approximation.

Unlike basic methods, Gaussian quadrature does not restrict these points to be evenly spaced. This freedom in choosing both weights and points effectively doubles the degrees of freedom, allowing Gaussian quadrature to attain a higher-order accuracy than traditional methods like Newton-Cotes for the same number of evaluations.

Another key advantage of Gaussian quadrature is that it can be customized for specific classes of functions. By selecting appropriate weights and abscissas, we can design quadrature formulas that are tailored to integrands of kind “polynomials times some known function W (x)” rather than for the usual class of integrands “polynomials”. Given such a weight function and a fixed number of points , we can determine weights and points that make the approximation

exact when is a polynomial.

Here some examples of weight functions:

Gauss-Legendre:

Gauss-Chebyshev:

Gauss-Laguerre:

Gauss-Hermite:

The computation of abscissas and weights can be easy or difficult depending on how much you already know about your weight function and its associated polynomials. In the case of classical, well-studied, orthogonal polynomials, practically everything is known, including good approximations for their zeros. These can be used as starting guesses, enabling Newton’s method to converge very rapidly.

Chebyshev

Chebyshev polynomials have analytic abscissas and weights:

Click here for the C/FORTRAN implementation.