NAG CL Interface
d01tcc (dim1_gauss_wgen)
1
Purpose
d01tcc returns the weights (normal or adjusted) and abscissae for a Gaussian integration rule with a specified number of abscissae. Six different types of Gauss rule are allowed.
2
Specification
The function may be called by the names: d01tcc or nag_quad_dim1_gauss_wgen.
3
Description
d01tcc returns the weights
and abscissae
for use in the summation
which approximates a definite integral (see
Davis and Rabinowitz (1975) or
Stroud and Secrest (1966)). The following types are provided:
-
(a)Gauss–Legendre
Constraint:
.
-
(b)Gauss–Jacobi
normal weights:
adjusted weights:
Constraint:
,
,
.
-
(c)Exponential Gauss
normal weights:
adjusted weights:
Constraint:
,
.
-
(d)Gauss–Laguerre
normal weights:
adjusted weights:
Constraint:
,
.
-
(e)Gauss–Hermite
normal weights:
adjusted weights:
Constraint:
,
.
-
(f)Rational Gauss
normal weights:
adjusted weights:
Constraint:
,
,
.
In the above formulae, stands for any polynomial of degree or less in .
The method used to calculate the abscissae involves finding the eigenvalues of the appropriate tridiagonal matrix (see
Golub and Welsch (1969)). The weights are then determined by the formula
where
is the
th orthogonal polynomial with respect to the weight function over the appropriate interval.
The weights and abscissae produced by
d01tcc may be passed to
d01fbc, which will evaluate the summations in one or more dimensions.
4
References
Davis P J and Rabinowitz P (1975) Methods of Numerical Integration Academic Press
Golub G H and Welsch J H (1969) Calculation of Gauss quadrature rules Math. Comput. 23 221–230
Stroud A H and Secrest D (1966) Gaussian Quadrature Formulas Prentice–Hall
5
Arguments
-
1:
– Nag_QuadType
Input
-
On entry: indicates the type of quadrature rule.
- Gauss–Legendre, with normal weights.
- Gauss–Jacobi, with normal weights.
- Gauss–Jacobi, with adjusted weights.
- Exponential Gauss, with normal weights.
- Exponential Gauss, with adjusted weights.
- Gauss–Laguerre, with normal weights.
- Gauss–Laguerre, with adjusted weights.
- Gauss–Hermite, with normal weights.
- Gauss–Hermite, with adjusted weights.
- Rational Gauss, with normal weights.
- Rational Gauss, with adjusted weights.
Constraint:
, , , , , , , , , or .
-
2:
– double
Input
-
3:
– double
Input
-
4:
– double
Input
-
5:
– double
Input
-
On entry: the parameters
,
,
and
which occur in the quadrature formulae described in
Section 3.
c is not used if
;
d is not used unless
,
,
or
. For some rules
c and
d must not be too large (see
Section 6).
Constraints:
- if , ;
- if or , and and ;
- if or , and ;
- if or , and ;
- if or , and ;
- if or , and and .
-
6:
– Integer
Input
-
On entry:
, the number of weights and abscissae to be returned. If
or
and
, an odd value of
n may raise problems (see
NE_INDETERMINATE).
Constraint:
.
-
7:
– double
Output
-
-
8:
– double
Output
-
On exit: the
n abscissae.
-
9:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_CONSTRAINT
-
On entry,
a,
b,
c, or
d is not in the allowed range:
,
,
and
.
- NE_CONVERGENCE
-
The algorithm for computing eigenvalues of a tridiagonal matrix has failed to converge.
- NE_INDETERMINATE
-
The contribution of the central abscissa to the summation is indeterminate.
- NE_INT
-
On entry, .
Constraint: .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library CL Interface for further information.
- NE_TOO_BIG
-
One or more of the weights are larger than
, the largest floating point number on this computer (see
X02ALC):
.
Possible solutions are to use a smaller value of
; or, if using adjusted weights to change to normal weights.
- NE_TOO_SMALL
-
One or more of the weights are too small to be distinguished from zero on this machine.
The underflowing weights are returned as zero, which may be a usable approximation.
Possible solutions are to use a smaller value of ; or, if using normal weights, to change to adjusted weights.
7
Accuracy
The accuracy depends mainly on , with increasing loss of accuracy for larger values of . Typically, one or two decimal digits may be lost from machine accuracy with , and three or four decimal digits may be lost for .
8
Parallelism and Performance
d01tcc 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 function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
The major portion of the time is taken up during the calculation of the eigenvalues of the appropriate tridiagonal matrix, where the time is roughly proportional to .
10
Example
This example returns the abscissae and (adjusted) weights for the seven-point Gauss–Laguerre formula.
10.1
Program Text
10.2
Program Data
10.3
Program Results