GaussQuad: Create knot and weight vectors for Gaussian quadrature

Description Usage Arguments Details Value References Examples

Description

Evaluate the positions (the “knots”) and the weights for various Gaussian quadrature rules. The quadrature rules are with respect to a kernel as described in the details section. Optional arguments a, b, alpha and beta are used to generalize the rules.

Usage

1
2
3
GaussQuad(n, rule = c("Legendre", "Chebyshev", "Gegenbauer", "Jacobi",
                      "Laguerre", "Hermite", "Exponential", "Rational"),
          a = 0, b = 1, alpha = 0, beta = 0)

Arguments

n

integer - number of quadrature points.

rule

character - a partial match to one of the quadrature rules, defaulting to "Legendre", see the details section.

a

numeric scalar - an optional shift parameter or interval endpoint

b

numeric scalar - an optional scale parameter or interval endpoint

alpha

numeric scalar - an optional power

beta

numeric scalar - another optional power

Details

The possible values for the rule character string and the corresponding integrals are:

“Legendre”

int_a^b f(x) dx

“Chebyshev”

int_a^b f(x) ((b-x)*(x-a))^(-0.5) dx

“Gegenbauer”

int_a^b f(x) ((b-x)*(x-a))^alpha dx

“Jacobi”

int_a^b f(x) (b-x)^alpha*(x-a)^beta

“Laguerre”

int_a^inf f(x)(x-a)^alpha*exp(-b*(x-a))

“Hermite”

int_-inf^inf f(x)|x-a|^alpha*exp(-b*(x-a)^2) dx

“Exponential”

int_-inf^inf f(x)|x-(a+b)/2.0|^alpha dx

“Rational”

int_a^inf f(x)(x-a)^alpha*(x+b)^beta

“Type2”

int_a^inf f(x)(x-a)^alpha*(x+b)^beta

Value

A list with components

knots

The positions at which to evaluate the function to be integrated

weights

The numeric weights to be applied.

References

The original FORTRAN implementation is from Sylvan Elhay, Jaroslav Kautsky (1987), “Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of Interpolatory Quadrature”, ACM Transactions on Mathematical Software, Volume 13, Number 4, December 1987, pages 399–415.

One of the Eispack routines, an implicit QL algorithms from Roger Martin and James Wilkinson (1968), “The Implicit QL Algorithm”, Numerische Mathematik, Volume 12, Number 5, December 1968, pages 377–383, is used in a modified form.

The C++ implementation by John Burkardt was modified to a C++ class by Douglas Bates.

Examples

1
2
do.call(data.frame, GaussQuad(5L, "Hermite")) ## 5-point "physicist" Gauss-Hermite rule
do.call(data.frame, GaussQuad(5L, "H", b=0.5)) ## 5-point "probabilist" Gauss-Hermite rule

Gqr documentation built on May 2, 2019, 5:46 p.m.

Related to GaussQuad in Gqr...