nag_quad_1d_gauss_wset (d01tbc) (PDF version)
d01 Chapter Contents
d01 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_quad_1d_gauss_wset (d01tbc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_quad_1d_gauss_wset (d01tbc) 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

#include <nag.h>
#include <nagd01.h>
void  nag_quad_1d_gauss_wset (Nag_QuadType quad_type, double a, double b, Integer n, double weight[], double abscis[], NagError *fail)

3  Description

nag_quad_1d_gauss_wset (d01tbc) 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  Arguments

1:     quad_typeNag_QuadTypeInput
On entry: indicates the quadrature formula.
quad_type=Nag_Quad_Gauss_Legendre
Gauss–Legendre quadrature on a finite interval, using normal weights.
quad_type=Nag_Quad_Gauss_Rational_Adjusted
Rational Gauss quadrature on a semi-infinite interval, using adjusted weights.
quad_type=Nag_Quad_Gauss_Laguerre_Adjusted
Gauss–Laguerre quadrature on a semi-infinite interval, using adjusted weights.
quad_type=Nag_Quad_Gauss_Hermite_Adjusted
Gauss–Hermite quadrature on an infinite interval, using adjusted weights.
quad_type=Nag_Quad_Gauss_Laguerre
Gauss–Laguerre quadrature on a semi-infinite interval, using normal weights.
quad_type=Nag_Quad_Gauss_Hermite
Gauss–Hermite quadrature on an infinite interval, using normal weights.
Constraint: quad_type=Nag_Quad_Gauss_Legendre, Nag_Quad_Gauss_Rational_Adjusted, Nag_Quad_Gauss_Laguerre_Adjusted, Nag_Quad_Gauss_Hermite_Adjusted, Nag_Quad_Gauss_Laguerre or Nag_Quad_Gauss_Hermite.
2:     adoubleInput
3:     bdoubleInput
On entry: the quantities a and b as described in the appropriate sub-section of Section 3.
Constraints:
  • if quad_type=Nag_Quad_Gauss_Rational_Adjusted, a+b0.0;
  • if quad_type=Nag_Quad_Gauss_Laguerre or Nag_Quad_Gauss_Laguerre_Adjusted, b0.0;
  • if quad_type=Nag_Quad_Gauss_Hermite or Nag_Quad_Gauss_Hermite_Adjusted, b>0.0.
4:     nIntegerInput
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.
5:     weight[n]doubleOutput
On exit: the n weights.
6:     abscis[n]doubleOutput
On exit: the n abscissae.
7:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_BAD_PARAM
On entry, argument value had an illegal value.
The value of a and/or b is invalid: a=value and b=value.
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.
NE_QUAD_GAUSS_NPTS_RULE
The n-point rule is not among those stored.
NE_TOO_SMALL
Underflow occurred in calculation of normal weights. Reduce n or use adjusted weights: n=value.

7  Accuracy

The weights and abscissae are stored for standard values of a and b to full machine accuracy.

8  Further Comments

Timing is negligible.

9  Example

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

9.1  Program Text

Program Text (d01tbce.c)

9.2  Program Data

Program Data (d01tbce.d)

9.3  Program Results

Program Results (d01tbce.r)


nag_quad_1d_gauss_wset (d01tbc) (PDF version)
d01 Chapter Contents
d01 Chapter Introduction
NAG C Library Manual

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