答案 0 :(得分:2)
正如我的评论中所建议的那样,它当然必须是一个方阵,但是只需从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}