我可以使用 Numpy 获得矩阵行列式吗? [英] Can I get the matrix determinant using Numpy?
本文介绍了我可以使用 Numpy 获得矩阵行列式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Numpy的手册中读到有函数det(M)
可以计算行列式.但是,我在 Numpy 中找不到 det()
方法.
I read in the manual of Numpy that there is function det(M)
that can calculate the determinant. However, I can't find the det()
method in Numpy.
顺便说一下,我使用 Python 2.5.Numpy应该没有兼容性问题.
By the way, I use Python 2.5. There should be no compatibility problems with Numpy.
推荐答案
您可以使用 numpy.linalg.det
计算数组的行列式:
You can use numpy.linalg.det
to compute the determinant of an array:
In [1]: import numpy
In [2]: M = [[1, 2], [3, 4]]
In [3]: print numpy.linalg.det(M)
Out[3]: -2.0000000000000004
这篇关于我可以使用 Numpy 获得矩阵行列式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文