The routine may be called by the names d01tdf or nagf_quad_dim1_gauss_wrec.
A tri-diagonal system of equations is formed from the coefficients of an underlying three-term recurrence formula:
for a set of othogonal polynomials induced by the quadrature. This is described in greater detail in the D01 Chapter Introduction. The user is required to specify the three-term recurrence and the value of the integral of the chosen weight function over the chosen interval.
As described in Golub and Welsch (1969) the abscissae are computed from the eigenvalues of this matrix and the weights from the first component of the eigenvectors.
LAPACK routines are used for the linear algebra to speed up computation.
Golub G H and Welsch J H (1969) Calculation of Gauss quadrature rules Math. Comput.23 221–230
1: – IntegerInput
On entry: , the number of Gauss points required. The resulting quadrature rule will be exact for all polynomials of degree .
On exit: elements of c are altered to make the underlying eigenvalue problem symmetric.
5: – Real (Kind=nag_wp)Input
On entry: muzero contains the definite integral of the weight function for the interval of interest.
6: – Real (Kind=nag_wp) arrayOutput
On exit: contains the weight corresponding to the th abscissa.
7: – Real (Kind=nag_wp) arrayOutput
On exit: the th abscissa.
8: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
The number of weights and abscissae requested (n) is less than : .
Unexpected failure in eigenvalue computation. Please contact NAG.
The algorithm failed to converge. The th diagonal was not zero: .
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
In general the computed weights and abscissae are accurate to a reasonable multiple of machine precision.
8Parallelism and Performance
d01tdf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
d01tdf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
The weight function must be non-negative to obtain sensible results. This and the validity of muzero are not something that the routine can check, so please be particularly careful. If possible check the computed weights and abscissae by integrating a function with a function for which you already know the integral.
This example program generates the weights and abscissae for the -point Gauss rules: Legendre, Chebyshev1, Chebyshev2, Jacobi, Laguerre and Hermite.