Function Repository Resource:

GeneralizedGaussianQuadratureWeights

Source Notebook

Get a numerically sorted list of abscissa-weight pairs for generalized Gaussian quadrature

Contributed by: Jan Mangaldan

ResourceFunction["GeneralizedGaussianQuadratureWeights"][n,poly]

gives a list of the n pairs {xi,wi} of the elementary n-point Gaussian quadrature formula associated with the orthogonal polynomial represented by poly, where wi is the weight of the abscissa xi.

ResourceFunction["GeneralizedGaussianQuadratureWeights"][n,poly,prec]

uses the working precision prec.

Details

Gaussian quadrature approximates the value of an integral as a linear combination of values of the integrand evaluated at optimal abscissas xi: , where w(x) and (a,b) are the weight function and orthogonality interval associated with the specified orthogonal polynomial.
The weights in Gaussian quadrature are sometimes referred to as Christoffel numbers or Cotes numbers.
The argument poly can be any of the following, with the corresponding integral type being approximated:
"ChebyshevFirst"Gauss–Chebyshev quadrature of the first kind,
"ChebyshevSecond"Gauss–Chebyshev quadrature of the second kind,
"Hermite"Gauss–Hermite quadrature,
"Laguerre"Gauss–Laguerre quadrature,
"Legendre"Gauss–Legendre quadrature,
{"Gegenbauer",m}Gauss–Gegenbauer quadrature,
{"Laguerre",a}generalized Gauss–Laguerre quadrature,
{"Jacobi",a,b}Gauss–Jacobi quadrature,
Strings in specifications like "Legendre" and {"Jacobi",a,b} can be replaced with the corresponding built-in symbols, as in LegendreP and {JacobiP,a,b}.
The precision argument acts similarly to the WorkingPrecision option used in many Wolfram Language numeric functions; it is not at all like the PrecisionGoal option. If the n argument is too small to allow for a high-precision result, extra precision in a result will not be meaningful.

Examples

Basic Examples (2) 

Generate the abscissas and weights for three-point Gauss–Legendre quadrature:

In[1]:=
ResourceFunction[
 "GeneralizedGaussianQuadratureWeights"][3, "Legendre"]
Out[1]=

Use 25-digit precision:

In[2]:=
ResourceFunction[
 "GeneralizedGaussianQuadratureWeights"][3, "Legendre", 25]
Out[2]=

Scope (2) 

Generate a four-point Gauss-Jacobi quadrature with specific values of a and b:

In[3]:=
ResourceFunction[
 "GeneralizedGaussianQuadratureWeights"][4, {"Jacobi", 3/2, -1/2}]
Out[3]=

An equivalent specification:

In[4]:=
ResourceFunction[
 "GeneralizedGaussianQuadratureWeights"][4, {JacobiP, 3/2, -1/2}]
Out[4]=

Applications (2) 

Use generalized Gauss–Laguerre quadrature to approximate the integral :

In[5]:=
gq = ResourceFunction["GeneralizedGaussianQuadratureWeights"][
   15, {"Laguerre", -1/2}, 20];
Total[#2 Cos[#1] & @@@ gq]
Out[5]=

Compare with the exact answer:

In[6]:=
% - \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(\[Infinity]\)]\(
\*SuperscriptBox[\(t\), \(\(-1\)/2\)] 
\*SuperscriptBox[\(E\), \(-t\)] Cos[t] \[DifferentialD]t\)\)
Out[6]=

Version History

  • 1.0.0 – 09 April 2021

Source Metadata

Related Resources

License Information