Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate the Hurwitz matrix of a univariate polynomial
| ResourceFunction["HurwitzMatrix"][poly,x] gives the Hurwitz matrix of poly, treated as a polynomial in x. | 
Generate the Hurwitz matrix of a polynomial:
| In[1]:= | ![ResourceFunction["HurwitzMatrix"][5 + 4 x + 3 x^2 + 2 x^3 + x^4 + x^5,
   x] // MatrixForm](https://www.wolframcloud.com/obj/resourcesystem/images/2e4/2e4af227-d008-4d84-8a32-f8f8f3dee90f/1-0-0/123f57d758a62919.png) | 
| Out[1]= |  | 
Generate the Hurwitz matrix from a polynomial with numeric coefficients:
| In[2]:= | ![ResourceFunction["HurwitzMatrix"][2 x^6 - 5 x^5 - 3 x + 9, x] // MatrixForm](https://www.wolframcloud.com/obj/resourcesystem/images/2e4/2e4af227-d008-4d84-8a32-f8f8f3dee90f/1-0-0/09ec8c877e24a399.png) | 
| Out[2]= |  | 
Generate the Hurwitz matrix from a polynomial with symbolic coefficients:
| In[3]:= | ![ResourceFunction["HurwitzMatrix"][\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(k = 0\), \(7\)]\(\*
TemplateBox[{"k"},
"C"] 
\*SuperscriptBox[\(x\), \(k\)]\)\), x] // MatrixForm](https://www.wolframcloud.com/obj/resourcesystem/images/2e4/2e4af227-d008-4d84-8a32-f8f8f3dee90f/1-0-0/7f07ec0e572b0e79.png) | 
| Out[3]= |  | 
Use HurwitzMatrix to check the stability of a polynomial:
| In[4]:= | ![poly = 1 + x/2 + x^2/9 + x^3/72 + x^4/1008 + x^5/30240;
MatrixForm[ma = ResourceFunction["HurwitzMatrix"][poly, x]]](https://www.wolframcloud.com/obj/resourcesystem/images/2e4/2e4af227-d008-4d84-8a32-f8f8f3dee90f/1-0-0/335f644705826643.png) | 
| Out[4]= |  | 
| In[5]:= | ![Table[Det[Take[ma, k, k]] > 0, {k, Exponent[poly, x]}]](https://www.wolframcloud.com/obj/resourcesystem/images/2e4/2e4af227-d008-4d84-8a32-f8f8f3dee90f/1-0-0/3f89937425490fe8.png) | 
| Out[5]= |  | 
Verify stability by computing the roots of the polynomial:
| In[6]:= | ![Re[x] < 0 /. NSolve[poly == 0, x]](https://www.wolframcloud.com/obj/resourcesystem/images/2e4/2e4af227-d008-4d84-8a32-f8f8f3dee90f/1-0-0/02f13aec44c9e063.png) | 
| Out[6]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License