我可以使用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.
推荐答案
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屋!
查看全文