D01BBF (PDF version)
D01 Chapter Contents
D01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

D01BBF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.
Note: please be advised that D01BBF has been deprecated and you are advised to use D01TBF.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

D01BBF returns the weights and abscissae appropriate to a Gaussian quadrature formula with a specified number of abscissae. The formulae provided are Gauss–Legendre, rational Gauss, Gauss–Laguerre and Gauss–Hermite.

2  Specification

SUBROUTINE D01BBF ( D01XXX, A, B, ITYPE, N, WEIGHT, ABSCIS, IFAIL)
INTEGER  ITYPE, N, IFAIL
REAL (KIND=nag_wp)  A, B, WEIGHT(N), ABSCIS(N)
EXTERNAL  D01XXX

3  Description

D01BBF returns the weights and abscissae for use in the Gaussian quadrature of a function fx. The quadrature takes the form
S=i=1nwifxi  
where wi are the weights and xi are the abscissae (see Davis and Rabinowitz (1975), Fröberg (1970), Ralston (1965) or Stroud and Secrest (1966)).
Weights and abscissae are available for Gauss–Legendre, rational Gauss, Gauss–Laguerre and Gauss–Hermite quadrature, and for a selection of values of n (see Section 5).
(a) Gauss–Legendre Quadrature:
Sabfxdx  
where a and b are finite and it will be exact for any function of the form
fx=i=0 2n-1cixi.  
(b) Rational Gauss quadrature, adjusted weights:
Safx dx a+b> 0   or   S-a fx dx a+b< 0  
and will be exact for any function of the form
fx=i=2 2n+1cix+bi=i=0 2n-1c2n+1-ix+bix+b2n+1.  
(c) Gauss–Laguerre quadrature, adjusted weights:
Safx dx b> 0   or   S-a fx dx b< 0  
and will be exact for any function of the form
fx=e-bxi=0 2n-1cixi.  
(d) Gauss–Hermite quadrature, adjusted weights:
S- + fx dx  
and will be exact for any function of the form
fx=e-b x-a 2i=0 2n-1cixib>0.  
(e) Gauss–Laguerre quadrature, normal weights:
Sae-bxfx dx b> 0   or   S-a e-bxfx dx b< 0  
and will be exact for any function of the form
fx=i=0 2n-1cixi.  
(f) Gauss–Hermite quadrature, normal weights:
S- + e-b x-a 2fx dx 
and will be exact for any function of the form
fx=i=0 2n-1cixi.  
Note:  the Gauss–Legendre abscissae, with a=-1, b=+1, are the zeros of the Legendre polynomials; the Gauss–Laguerre abscissae, with a=0, b=1, are the zeros of the Laguerre polynomials; and the Gauss–Hermite abscissae, with a=0, b=1, are the zeros of the Hermite polynomials.

4  References

Davis P J and Rabinowitz P (1975) Methods of Numerical Integration Academic Press
Fröberg C E (1970) Introduction to Numerical Analysis Addison–Wesley
Ralston A (1965) A First Course in Numerical Analysis pp. 87–90 McGraw–Hill
Stroud A H and Secrest D (1966) Gaussian Quadrature Formulas Prentice–Hall

5  Parameters

1:     D01XXX – SUBROUTINE, supplied by the NAG Library.External Procedure
The name of the routine indicates the quadrature formula:
  • D01BAZ, for Gauss–Legendre weights and abscissae;
  • D01BAY, for rational Gauss weights and abscissae;
  • D01BAX, for Gauss–Laguerre weights and abscissae;
  • D01BAW, for Gauss–Hermite weights and abscissae.
The name used must be declared as EXTERNAL in the subroutine from which D01BBF is called.
2:     A – REAL (KIND=nag_wp)Input
3:     B – REAL (KIND=nag_wp)Input
On entry: the quantities a and b as described in the appropriate sub-section of Section 3.
4:     ITYPE – INTEGERInput
On entry: indicates the type of weights for Gauss–Laguerre or Gauss–Hermite quadrature (see Section 3).
ITYPE=1
Adjusted weights will be returned.
ITYPE=0
Normal weights will be returned.
Constraint: ITYPE=0 or 1.
For Gauss–Legendre or rational Gauss quadrature, this parameter is not used.
5:     N – INTEGERInput
On entry: n, the number of weights and abscissae to be returned.
Constraint: N=1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 20, 24, 32, 48 or 64.
6:     WEIGHTN – REAL (KIND=nag_wp) arrayOutput
On exit: the N weights. For Gauss–Laguerre and Gauss–Hermite quadrature, these will be the adjusted weights if ITYPE=1, and the normal weights if ITYPE=0.
7:     ABSCISN – REAL (KIND=nag_wp) arrayOutput
On exit: the N abscissae.
8:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
The N-point rule is not among those stored. If the soft fail option is used, the weights and abscissae returned will be those for the largest valid value of N less than the requested value, and the excess elements of WEIGHT and ABSCIS (i.e., up to the requested N) will be filled with zeros.
IFAIL=2
The value of A and/or B is invalid.
Rational Gauss: A+B=0.0 
Gauss–Laguerre: B=0.0 
Gauss–Hermite: B0.0
If the soft fail option is used the weights and abscissae are returned as zero.
IFAIL=3
Laguerre and Hermite normal weights only: underflow is occurring in evaluating one or more of the normal weights. If the soft fail option is used, the underflowing weights are returned as zero. A smaller value of N must be used; or adjusted weights should be used (ITYPE=1). In the latter case, take care that underflow does not occur when evaluating the integrand appropriate for adjusted weights.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

The weights and abscissae are stored for standard values of A and B to full machine accuracy.

8  Parallelism and Performance

Not applicable.

9  Further Comments

Timing is negligible.

10  Example

This example returns the abscissae and (adjusted) weights for the six-point Gauss–Laguerre formula.

10.1  Program Text

Program Text (d01bbfe.f90)

10.2  Program Data

None.

10.3  Program Results

Program Results (d01bbfe.r)


D01BBF (PDF version)
D01 Chapter Contents
D01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015