quadmom, an Octave code which computes a Gaussian quadrature rule for a weight function rho(x) based on the Golub-Welsch procedure that only requires knowledge of the moments of rho(x).

The standard Golub-Welsch procedure expects to work with the coefficients alpha() and beta() of the three term recursion for the orthogonal polynomials associated with the weight function rho(x).

However, in the same paper, Golub and Welsch discuss a related procedure which, to compute a Gaussian quadrature rule of order N, requires the values of the first M=2*N+1 moments associated with rho(x):

        mu(k) = integral x^k rho(x) dx,  0 <= k <= 2*n
This library demonstrates this moment-based procedure.

Executing the sample program requires access to the TOMS655 library as well.


The computer code and data files made available on this web page are distributed under the MIT license


quadmom is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and a Octave version.

Related Data and Programs:


quadrature_golub_welsch, an Octave code which computes the points and weights of a Gaussian quadrature rule using the Golub-Welsch procedure, assuming that the points have been specified.

quadrature_least_squares, an Octave code which computes weights for "sub-interpolatory" quadrature rules, that is, it estimates integrals by integrating a polynomial that approximates the function data in a least squares sense.

quad_rule, an Octave code which contains information about quadrature rules, both as tabulated values, and as computational procedures.

toms655, an Octave code which computes the weights for interpolatory quadrature rules; this library is commonly called IQPACK, by Sylvan Elhay and Jaroslav Kautsky.


  1. Sylvan Elhay, Jaroslav Kautsky,
    Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of Interpolatory Quadrature,
    ACM Transactions on Mathematical Software,
    Volume 13, Number 4, December 1987, pages 399-415.
  2. Gene Golub, John Welsch,
    Calculation of Gaussian Quadrature Rules,
    Mathematics of Computation,
    Volume 23, Number 106, April 1969, pages 221-230.
  3. Jaroslav Kautsky, Sylvan Elhay,
    Calculation of the Weights of Interpolatory Quadratures,
    Numerische Mathematik,
    Volume 40, Number 3, October 1982, pages 407-422.

Source Code:

Last revised on 12 January 2021.