Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Symmetric tridiagonal matrix for Gaussian quadrature
| ResourceFunction["GaussianQuadratureMatrix"][n] returns the n×n symmetric tridiagonal matrix that determines the abscissas and weights of the Gaussian quadrature. | 
Compute the symmetric tridiagonal matrix of size 6×6:
| In[1]:= | ![ResourceFunction["GaussianQuadratureMatrix"][6]](https://www.wolframcloud.com/obj/resourcesystem/images/474/47409d50-f09b-4d7e-ba1d-06248a811cb8/4aa89a69873745e5.png) | 
| Out[1]= |  | 
| In[2]:= |  | 
| Out[2]= |  | 
The abscissas and weights for the elementary n-point Gaussian quadrature are related to the eigensystem of the n⨯n symmetric tridiagonal Gaussian quadrature matrix:
| In[3]:= |  | 
| In[4]:= | ![{xx, ww} = Transpose[
   ResourceFunction["GaussianQuadratureWeights"][n, {-1, 1}]];](https://www.wolframcloud.com/obj/resourcesystem/images/474/47409d50-f09b-4d7e-ba1d-06248a811cb8/1ca52741c18213fa.png) | 
| In[5]:= | ![(m = ResourceFunction["GaussianQuadratureMatrix"][n]) // MatrixForm](https://www.wolframcloud.com/obj/resourcesystem/images/474/47409d50-f09b-4d7e-ba1d-06248a811cb8/6e66ae89f20b7248.png) | 
| Out[5]= |  | 
Eigenvalues of the matrix determine the abscissas:
| In[6]:= | ![Eigenvalues[m] // NumericalSort](https://www.wolframcloud.com/obj/resourcesystem/images/474/47409d50-f09b-4d7e-ba1d-06248a811cb8/69094c344747f6f5.png) | 
| Out[6]= |  | 
| In[7]:= |  | 
| Out[7]= |  | 
Eigenvectors of the matrix determine the weights:
| In[8]:= | ![{Eigenvalues[m], 2 (Normalize /@ Eigenvectors[m])[[All, 1]]^2} // Transpose // NumericalSort // Transpose;](https://www.wolframcloud.com/obj/resourcesystem/images/474/47409d50-f09b-4d7e-ba1d-06248a811cb8/2d4583a6df71f77b.png) | 
| In[9]:= | ![%[[2]] - ww // Simplify](https://www.wolframcloud.com/obj/resourcesystem/images/474/47409d50-f09b-4d7e-ba1d-06248a811cb8/5d8b79caf4423c73.png) | 
| Out[9]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License