Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the Smith decomposition of a matrix of univariate polynomials
ResourceFunction["PolynomialSmithDecomposition"][mat] computes the Smith decomposition of the matrix mat of univariate polynomials. | |
ResourceFunction["PolynomialSmithDecomposition"][mat,x] computes the Smith decomposition for a matrix of polynomials in the variable x. |
Compute the Smith decomposition of a 2×3 matrix of low degree polynomials:
| In[1]:= | ![]() |
| Out[2]= | ![]() |
Check the matrix equation:
| In[3]:= |
| Out[3]= |
Check that u and v are unimodular; that is, they are constants:
| In[4]:= |
| Out[4]= |
Check that the diagonal entries of s divide into subsequent entries:
| In[5]:= |
| Out[5]= |
Generate and compute the Smith decomposition for an 8×12 matrix of random degree-5 polynomials with coefficients between -10 and 10:
| In[6]:= | ![]() |
| Out[10]= |
As is often the case in symbolic computation, speed improves when one works over a prime field of modest size:
| In[11]:= |
| Out[11]= |
Check that the Smith form is a diagonal matrix:
| In[12]:= |
| Out[12]= |
Check that the decomposition satisfies the necessary matrix identity:
| In[13]:= |
| Out[13]= | ![]() |
Check that the left factor is unimodular:
| In[14]:= |
| Out[14]= |
The determinant of the right factor cannot easily be computed due to expression swell. A probabilistic test that it is unimodular (that is, a constant) is to check that it gives the same value with multiple substitutions of the polynomial variable:
| In[15]:= |
| Out[15]= |
Use the Smith decomposition to compute the minimal polynomial of a matrix:
| In[16]:= | ![]() |
| In[17]:= |
| Out[17]= |
The result from PolynomialSmithDecomposition is a scalar multiple of the result of the resource function MatrixMinimalPolynomial:
| In[18]:= |
| Out[18]= |
For a square matrix mat, the nontrivial diagonal elements in the Smith normal form for mat-x ℑ are the invariant factors of the characteristic polynomial of mat (here ℑ is the identity matrix of same dimension as mat). We can use this to compute the rational canonical form.
We start with code to create a companion matrix from a polynomial:
| In[19]:= | ![]() |
Work with an upper triangular matrix having a nontrivial minimal polynomial and hence nontrivial rational canonical form:
| In[20]:= | ![]() |
| Out[23]= | ![]() |
Find the diagonal for the Smith normal form of mat-x:
| In[24]:= |
| Out[25]= |
Compute the submatrices for the diagonal block:
| In[26]:= |
| Out[26]= |
Use SparseArray and Band to reconstruct the companion matrix for mat as a diagonal block matrix:
| In[27]:= |
| Out[27]= |
This work is licensed under a Creative Commons Attribution 4.0 International License