Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Evaluate a matrix polynomial
ResourceFunction["MatrixPolynomial"][p,m] gives the matrix generated by the polynomial function p at the matrix argument m. | |
ResourceFunction["MatrixPolynomial"][p,m,v] gives the matrix generated by the polynomial function p at the matrix argument m, applied to the vector v. |
Compute a matrix polynomial, specifying the polynomial as a pure function:
In[1]:= | ![]() |
Out[1]= | ![]() |
Evaluate a matrix polynomial with a machine-precision matrix:
In[2]:= | ![]() |
Out[2]= | ![]() |
The polynomial can be specified as a list of coefficients:
In[3]:= | ![]() |
Out[3]= | ![]() |
Evaluate a matrix polynomial with a complex matrix:
In[4]:= | ![]() |
Out[4]= | ![]() |
Evaluate a matrix polynomial with an arbitrary-precision matrix:
In[5]:= | ![]() |
Out[5]= | ![]() |
Evaluating a matrix polynomial with a large machine-precision matrix is efficient:
In[6]:= | ![]() |
Out[7]= | ![]() |
Directly applying the matrix polynomial to a single vector is even more efficient:
In[8]:= | ![]() |
Out[9]= | ![]() |
Compute a matrix polynomial applied to a vector for a sparse matrix:
In[10]:= | ![]() |
Out[12]= | ![]() |
Evaluate a matrix rational function:
In[13]:= | ![]() |
Out[13]= | ![]() |
In[14]:= | ![]() |
Out[17]= | ![]() |
Compare with the result of MatrixFunction:
In[18]:= | ![]() |
Out[18]= | ![]() |
MatrixPolynomial is more efficient than MatrixFunction:
In[19]:= | ![]() |
Out[19]= | ![]() |
In[20]:= | ![]() |
Out[20]= | ![]() |
If m is diagonalizable with m=v.d.v-1 and the eigenvectors are well conditioned, then p(m)=v.p(d).v-1:
In[21]:= | ![]() |
Out[23]= | ![]() |
In[24]:= | ![]() |
Out[24]= | ![]() |
Demonstrate the Cayley–Hamilton theorem:
In[25]:= | ![]() |
Out[25]= | ![]() |
In[26]:= | ![]() |
Out[26]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License