naginterfaces.library.quad.dim1_gauss_wgen¶
- naginterfaces.library.quad.dim1_gauss_wgen(itype, a, b, c, d, n)[source]¶
dim1_gauss_wgen
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.For full information please refer to the NAG Library document for d01tc
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/d01/d01tcf.html
- Parameters
- itypeint
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.
- afloat
The parameter which occurs in the quadrature formula
- bfloat
The parameter which occurs in the quadrature formula
- cfloat
The parameter which occurs in the quadrature formula
- dfloat
The parameter which occurs in the quadrature formula
- nint
, the number of weights and abscissae to be returned. If or and , an odd value of may raise problems (see = 6).
- Returns
- weightfloat, ndarray, shape
The weights.
- abscisfloat, ndarray, shape
The abscissae.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, , , , or is not in the allowed range: , , and .
- Warns
- NagAlgorithmicWarning
- (errno )
The algorithm for computing eigenvalues of a tridiagonal matrix has failed to converge.
- (errno )
One or more of the weights are larger than , the largest floating point number on this computer (see
machine.real_largest
): .Possible solutions are to use a smaller value of ; or, if using adjusted weights to change to normal weights.
- (errno )
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.
- (errno )
The contribution of the central abscissa to the summation is indeterminate.
- Notes
dim1_gauss_wgen
returns the weights and abscissae for use in the summationwhich approximates a definite integral (see Davis and Rabinowitz (1975) and Stroud and Secrest (1966)). The following types are provided:
Gauss–Legendre
Constraint: .
Gauss–Jacobi
normal weights:
adjusted weights:
Constraint: , , .
Exponential Gauss
normal weights:
adjusted weights:
Constraint: , .
Gauss–Laguerre
normal weights:
adjusted weights:
Constraint: , .
Gauss–Hermite
normal weights:
adjusted weights:
Constraint: , .
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
dim1_gauss_wgen
may be passed tomd_gauss()
, which will evaluate the summations in one or more dimensions.
- 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