Function Repository Resource:

QuadratureWeightsToJacobiMatrix

Source Notebook

Recover a Jacobi matrix from a list of abscissa-weight pairs

Contributed by: Jan Mangaldan

ResourceFunction["QuadratureWeightsToJacobiMatrix"][{{x1,w1},{x2,w2},}]

returns a list {j,c}, where j is the Jacobi matrix corresponding to the quadrature rule represented by the abscissa-weight pairs {xi,wi} and normalization factor c.

Examples

Basic Examples (2) 

The resource function GaussianQuadratureWeights gives a list of abscissa-weight pairs for Gauss-Legendre quadrature:

In[1]:=
da = ResourceFunction["GaussianQuadratureWeights"][10, {-1, 1}, 25]
Out[1]=

Recover the corresponding Jacobi matrix and normalization factor:

In[2]:=
ResourceFunction["QuadratureWeightsToJacobiMatrix"][da]
Out[2]=

Scope (4) 

Use the resource function GeneralizedGaussianQuadratureWeights to generate a Gauss-Laguerre quadrature rule:

In[3]:=
da = ResourceFunction["GeneralizedGaussianQuadratureWeights"][
  10, {"Laguerre", -1/2}, 25]
Out[3]=

Recover the Jacobi matrix and normalization factor from the quadrature data:

In[4]:=
{jac, nrm} = ResourceFunction["QuadratureWeightsToJacobiMatrix"][da]
Out[4]=

Compare the recovered Jacobi matrix with the result of the resource function JacobiMatrix:

In[5]:=
Norm[jac - ResourceFunction[
ResourceObject[<|"Name" -> "JacobiMatrix", "ShortName" -> "JacobiMatrix", "UUID" -> "4c9b41c3-b03b-4570-89e0-89ad1ebadf23", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Generate the Jacobi matrix corresponding to an orthogonal polynomial", "RepositoryLocation" -> URL[
       "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$aad0ba1790aa4747aabab033069bbc7a`JacobiMatrix", "FunctionLocation" -> CloudObject[
       "https://www.wolframcloud.com/obj/baa057de-bffc-4f0c-a440-165fb40136e8"]|>, {ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"}]][10, {"Laguerre", -1/2}], \[Infinity]]
Out[5]=

The normalization factor is equal to the sum of the weights:

In[6]:=
nrm - Total[da[[All, 2]]]
Out[6]=

Applications (2) 

QuadratureWeightsToJacobiMatrix can be used even on non-Gaussian quadrature rules. Build a Jacobi matrix from a Newton-Cotes rule:

In[7]:=
{jac, nrm} = ResourceFunction["QuadratureWeightsToJacobiMatrix"][
  N[ResourceFunction["NewtonCotesWeights"][10, -1, 1, "QuadratureType" -> Open]]]
Out[7]=

The resulting Jacobi matrix is unsymmetric because some the weights of the quadrature rule are negative:

In[8]:=
MatrixPlot[jac]
Out[8]=

A Clenshaw-Curtis rule whose weights are all positive will yield a symmetric Jacobi matrix:

In[9]:=
{jac, nrm} = ResourceFunction["QuadratureWeightsToJacobiMatrix"][
  N[ResourceFunction["ClenshawCurtisQuadratureWeights"][10, {-1, 1}]]]
Out[9]=
In[10]:=
MatrixPlot[jac]
Out[10]=

Version History

  • 1.0.0 – 06 April 2021

Source Metadata

Related Resources

Author Notes

This function incorporates a modification of the RKPW algorithm in the Gragg-Harrod paper that was suggested in the Gates-Gragg paper.

License Information