0
Matrix determinant calculation?
I need to write a function which generate a random matrix (bigger than 2x2). And calculate all the 2x2 part determinant of the generated matrix and generate a new matrix with that values.
7 ответов
+ 2
Show your attempt first
+ 1
For bigger numbers you have to take bigger inputs
+ 1
Hope this helps you
0
arr = np.random.randint(1,10,(3,3))
matrix = np.zeros((3,3))
matrix[0][0] = int(np.linalg.det(arr[0:2,0:2]))
matrix[0][1] = int(np.linalg.det(arr[0:2,1:3]))
matrix[1][0] = int(np.linalg.det(arr[1:3,0:2]))
matrix[1][1] = int(np.linalg.det(arr[1:3,1:3]))
0
That's what i tried, but it works only on a 3x3 matrix. How can i edit this code to work on a different size of matrix? For example 4x5 or 7x7 or 16x16? Thanks for your help.