下面的代码可以正常工作
import numpy.linalg as nplin
T = [[1,0],[0,1]]
nplin.eig(T)
从而产生输出
^{pr2}$但是如果我试图使用sympy中的Matrix
对象
import numpy.linalg as nplin
from sympy import Matrix
T = Matrix([[1,0],[0,1]])
nplin.eig(T)
我得到以下错误
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
即使我把SymPy矩阵对象转换成NumPy数组
import numpy.linalg as nplin
import numpy
from sympy import Matrix
T = numpy.array(Matrix([[1,0],[0,1]]))
nplin.eig(T)
我还是犯了同样的错误。这里有什么问题?在
我正在使用Python 2.7.9
、NumPy 1.8.2
和{
目前没有回答
相关问题 更多 >
编程相关推荐