简体   繁体   English

如何通过python找到矩阵的特征多项式?

[英]How to find characteristic polynomial of matrices by python?

Let $A$ be a $n\\times n$ matrice. 让$ A $为$ n \\次n $ matrice。 I want to calculate characteristic polynomial of $A$ ie I want to calculate $$det(xI-A)$$. 我想计算$ A $的特征多项式,即我想计算$$ det(xI-A)$$。

Is there any function which find this in python ? 有什么功能可以在python中找到它吗?

It sounds like you are interested in a symbolic solution? 听起来你对符号解决方案感兴趣? The characteristic polynomial doesn't make much sense numerically, where you would probably be more interested in the eigenvalues. 特征多项式在数值上没有多大意义,你可能会对特征值更感兴趣。 To obtain the characteristic polynomial of a symbolic matrix M in SymPy you want to use the M.charpoly method. 要在SymPy中获得符号矩阵M的特征多项式,您需要使用M.charpoly方法。

For more information, see the SymPy documentation on matrices and linear algebra: http://docs.sympy.org/latest/modules/matrices/matrices.html 有关更多信息,请参阅有关矩阵和线性代数的SymPy文档: http//docs.sympy.org/latest/modules/matrices/matrices.html

If you want to find the eigenvalues of a numpy array, numpy.linalg.eigvals (or numpy.linalg.eigvalsh if you have a Hermitian matrix) is what you want. 如果你想找到一个numpy数组的特征值, numpy.linalg.eigvals (如果你有一个Hermitian矩阵, numpy.linalg.eigvals numpy.linalg.eigvalsh )就是你想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM