如何确定sympy.matrices.dense.MutableDenseMatrix的特征值?
How to determine the eigenvalues of sympy.matrices.dense.MutableDenseMatrix?
Python SymPy 矩阵 API 有一个 method to determine the eigenvalue. I would like to do similar thing with SymPy MutableDenseMatrix. Unfortunately, the API 不允许我这样做。
有什么办法吗?
正如我在评论中所建议的那样,它当然必须是一个方阵,但是只需从您的 MutableDenseMatrix 构造一个矩阵即可:
>>> from sympy.matrices.dense import MutableDenseMatrix
>>> from sympy.matrices import Matrix
>>> a = MutableDenseMatrix([[1,0,0], [0,0,0], [2, -2, 3]])
>>> b = Matrix(a)
>>> b.eigenvals()
{0: 1, 1: 1, 3: 1}
Python SymPy 矩阵 API 有一个 method to determine the eigenvalue. I would like to do similar thing with SymPy MutableDenseMatrix. Unfortunately, the API 不允许我这样做。
有什么办法吗?
正如我在评论中所建议的那样,它当然必须是一个方阵,但是只需从您的 MutableDenseMatrix 构造一个矩阵即可:
>>> from sympy.matrices.dense import MutableDenseMatrix
>>> from sympy.matrices import Matrix
>>> a = MutableDenseMatrix([[1,0,0], [0,0,0], [2, -2, 3]])
>>> b = Matrix(a)
>>> b.eigenvals()
{0: 1, 1: 1, 3: 1}