I need 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.
that's my code:

that's my code:
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]))how can i edit this to work for exaple on a 4x4 or on a 16x16 matrix?
Larz60+ write Apr-16-2021, 08:27 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time, please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time, please use bbcode tags on future posts.