# ARBITRARY_WEIGHT_RULE Gauss Quadrature Rules for Arbitrary Weights

ARBITRARY_WEIGHT_RULE is a Mathematica package which accepts a formula for an arbitrary (but nonnegative) weight function over an interval, and determines the points and weights of a corresponding Gaussian quadrature rule, by Fukuda, Katsuya, Alt and Matveenko.

The integral to be approximated has the form

If = Integral ( a < x z< b ) f(z(x)) w(x) dx
where a is allowed to be -oo, and b is allowed to be +oo. The function z(x) is a monotonic (that is, invertible) function of x introduced for convenience. The weight function w(x) is assumed to be positive everywhere within the range, except perhaps for isolated points where it may be zero.

A Gauss quadrature rule Q of order n is a set of points xi and weights wi which approximate the integral If by

If approx Qf = Sum ( 1 <= i <= n ) wi f(z(xi))
with the property that the approximation is exact in cases where f(z(x)) is a polynomial of degree 2*n-1 or less.

The Mathematica program is not interactive. To be used, it requires the user to modify the text of the program to specify certain quantities.

Quantities the user must specify include:

• a and b, the integration limits;
• w(x), the formula for the weight;
• u=z(x), the formula for the transformation; In most cases, u=x can be used;
• zi(u), the formula for the inverse transformation; In most cases, zi=u can be used.
• n, the order of the desired Gauss quadrature rule.

Other quantities which the user may wish to change, but which are already set to reasonable values, include:

• Nm, the internal precision (number of digits of accuracy) for the moments (set to 50);
• Nz, the internal precision (number of digits of accuracy) for the Jacobi matrix (set to 25);
• Na, the final precision (number of digits of accuracy) in the abscissas and weights of the rule (set to 17);
• outputww, set to 0 for the weights, or 1 for the weights divided by W(x) (set to 0);
• fortranfname, the name of the file to be created, containing a FORTRAN77 program that defines the abscissas and weights (set to "gqxw.f");

### Related Data and Programs:

TOMS655 a FORTRAN77 library which computes the weights for interpolatory quadrature rule;
this library is commonly called IQPACK;
this is ACM TOMS algorithm 655.

TOMS726 a FORTRAN77 library which computes recursion coefficients for orthogonal polynomials, and the abscissa and weights for related quadrature rules;
this library is commonly called ORTHPOL;
this is ACM TOMS algorithm 726.

### Reference:

1. Hiroshi Fukuda, Mitsuaki Katsuya, Erwin Alt, Alexander Matveenko,
Gaussian quadrature rule for arbitrary weight function and interval,
Computer Physics Communications,
Volume 167, Number 2, 15 April 2005, pages 143-150.

### Examples and Tests:

• gqxw.f, the FORTRAN77 program corresponding to integration over [0,1] with weight function w(x)=1/x, the identity transformation, and a requested order of 4.
• testrun.pdf, the printout of a test run for the case [1,+oo) with weight function 1/(1+x^2)^2, the identity transformation, and a requested order of 4.

You can go up one level to the Mathematica packages and notebooks.

Last revised on 10 November 2010.