python中的反矩阵(numpy/sympy)
我有一个包含复数数字的顺序8*8的矩阵(a
)。 我想计算该矩阵的倒数,因此我使用了np.linalg.inv(b)
命令,但我有一个错误:
ufuntypeypeerror:无法将dtype('o')的ufunc'spt'输入施加到 dtype('float64')带有铸造规则'same_kind'
值得一提的是:
In [169]: type(A)
Out[169]: numpy.matrix
In [171]:type(A[0,0])
Out[171]: sympy.core.mul.Mul
如何计算该矩阵的倒数?我有点困惑,我应该在哪个图书馆搜索? numpy还是Sympy?由于矩阵类型为numpy,但是其组件是sympy。 谢谢
I have a matrix (A
) of order 8*8 which contains complex numbers.
I would like to calculate the inverse of that matrix, so I used np.linalg.inv(b)
command but I got an error:
UFuncTypeError: Cannot cast ufunc 'inv' input from dtype('O') to
dtype('float64') with casting rule 'same_kind'
It's worth to mention that:
In [169]: type(A)
Out[169]: numpy.matrix
In [171]:type(A[0,0])
Out[171]: sympy.core.mul.Mul
How can I calculate the inverse of that matrix? I have been a little confused, in which library should I search for? NumPy or SymPy? since the matrix type is NumPy however its component is SymPy.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论