beginner07
New Coder
The problem is that,to write a function which generate a random matrix (bigger than 2x2). And calculate all the 2x2 part determinant of the original matrix.Then generate a new matrix with that values.
For example:
generated matrix
[4, 4, 8, 1
2, 6, 4, 7
1, 6, 6, 10]
calculated matrix
[16, -32, 52
6, 12, -2]
Thanks for your answer🙂
That's my code but it works only on 3x4 matrix. How can i edit this to function on a random shape matrix?
For example:
generated matrix
[4, 4, 8, 1
2, 6, 4, 7
1, 6, 6, 10]
calculated matrix
[16, -32, 52
6, 12, -2]
Thanks for your answer🙂
That's my code but it works only on 3x4 matrix. How can i edit this to function on a random shape matrix?
Python:
arr = np.random.randint(1,10,(3,4))
matrix = np.zeros((2,3))
matrix[0,0] = int(np.linalg.det(np.array([arr[i][0:2] for i in range(0,2)])))
matrix[0,1] = int(np.linalg.det(np.array([arr[i][1:3] for i in range(0,2)])))
matrix[0,2] = int(np.linalg.det(np.array([arr[i][2:] for i in range(0,2)])))
matrix[1,0] = int(np.linalg.det(np.array([arr[i][0:2] for i in range(1,3)])))
matrix[1,1] = int(np.linalg.det(np.array([arr[i][1:3] for i in range(1,3)])))
matrix[1,2] = int(np.linalg.det(np.array([arr[i][2:] for i in range(1,3)])))