Can I get the matrix determinant using Numpy?

后端 未结 2 1334
花落未央
花落未央 2020-12-05 09:37

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.

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-05 10:08

    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
    

提交回复
热议问题