Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate the Jacobi matrix corresponding to an orthogonal polynomial
| ResourceFunction["JacobiMatrix"][n,poly] yields the nth order Jacobi matrix corresponding to the orthogonal polynomial pn(x) represented by poly. | 
| "ChebyshevFirst" | Chebyshev polynomial of the first kind ChebyshevT[n,x] | 
| "ChebyshevSecond" | Chebyshev polynomial of the second kind ChebyshevU[n,x] | 
| "Hermite" | Hermite polynomial HermiteH[n,x] | 
| "Laguerre" | Laguerre polynomial LaguerreL[n,x] | 
| "Legendre" | Legendre polynomial LegendreP[n,x] | 
| {"Gegenbauer",m} | Gegenbauer polynomial GegenbauerC[n,m,z] | 
| {"Laguerre",a} | associated Laguerre polynomial LaguerreL[n,a,x] | 
| {"Jacobi",a,b} | Jacobi polynomial JacobiP[n,a,b,x] | 
The Jacobi matrix corresponding to a Legendre polynomial:
| In[1]:= | ![ResourceFunction["JacobiMatrix"][4, "Legendre"] // MatrixForm](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/60075f835a336e33.png)  | 
| Out[1]= |   | 
Jacobi matrix of a Jacobi polynomial with symbolic parameters:
| In[2]:= | ![ResourceFunction["JacobiMatrix"][
  3, {"Jacobi", \[Alpha], \[Beta]}] // MatrixForm](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/445ad853d65fdc26.png)  | 
| Out[2]= |   | 
An equivalent specification:
| In[3]:= | ![ResourceFunction["JacobiMatrix"][
  3, {JacobiP, \[Alpha], \[Beta]}] // MatrixForm](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/4fb05dc54b424af7.png)  | 
| Out[3]= |   | 
Symmetric and unsymmetric Jacobi matrices for an associated Laguerre polynomial:
| In[4]:= | ![MatrixForm /@ {ResourceFunction["JacobiMatrix"][
   4, {"Laguerre", \[Alpha]}, "Symmetric" -> True], ResourceFunction["JacobiMatrix"][4, {"Laguerre", \[Alpha]}, "Symmetric" -> False]}](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/28ab511075dd63bf.png)  | 
| Out[4]= |   | 
Find the roots of an orthogonal polynomial by computing the eigenvalues of a Jacobi matrix:
| In[5]:= | ![Eigenvalues[
  N[ResourceFunction["JacobiMatrix"][4, {"Laguerre", -1/3}]]] // Sort](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/104fea48fb85e052.png)  | 
| Out[5]= |   | 
Compare with the result of using NSolve:
| In[6]:= | ![x /. NSolve[LaguerreL[4, -1/3, x] == 0, x]](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/111427ce06dc85c4.png)  | 
| Out[6]= |   | 
The characteristic polynomial of a Jacobi matrix is a scalar multiple of the associated orthogonal polynomial:
| In[7]:= | ![CharacteristicPolynomial[
 ResourceFunction["JacobiMatrix"][4, "Hermite"], x]](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/1e72c4ade1020fda.png)  | 
| Out[7]= |   | 
| In[8]:= | ![#/Coefficient[#, x, Exponent[#, x]] &[HermiteH[4, x]] // Expand](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/5bf14b3c00fe9930.png)  | 
| Out[8]= |   | 
The unsymmetric and symmetric Jacobi matrices are related to each other through a similarity transformation:
| In[9]:= | ![m1 = ResourceFunction["JacobiMatrix"][4, LaguerreL, "Symmetric" -> True];
m2 = ResourceFunction["JacobiMatrix"][4, LaguerreL, "Symmetric" -> False];
With[{d = FoldList[Times, 1, Normal@Diagonal[m1, 1]]}, m1 == DiagonalMatrix[d] . m2 . DiagonalMatrix[1/d]]](https://www.wolframcloud.com/obj/resourcesystem/images/4c9/4c9b41c3-b03b-4570-89e0-89ad1ebadf23/755c9ec44357d826.png)  | 
| Out[9]= |   | 
This work is licensed under a Creative Commons Attribution 4.0 International License