computing the determinants of matrices in an array using python
Question: Say you have a numpy array of matrices e.g. an array of dimension (n,m,m).
Think of it as n matrices each of size mxm. Is there a way (not using a loop)
of computing the determinant of each each matrix in one go?


Answer: You can calculate the determinant of numpy arrays
using[`numpy.linalg.det`](http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.det.html)
as shown below:

    
    
    import numpy as np
    
    N = 10
    M = 4
    
    # Generate N random MxM arrays
    arrays = np.array([np.random.random((M,M)) for _ in range(N)])
    
    dets = np.linalg.det(arrays)
    print(dets)
    # array([-0.20353081,  0.01632881, -0.17733447, -0.01518313, -0.23457492,
    #        0.00284906,  0.16210605,  0.03887231,  0.07726804, -0.05107936])
    

In the example above I have 10 matrices of size 4x4 (randomly generated as an
example). `dets` is a numpy array of 10 numbers, your determinants.

