Last active
October 27, 2021 12:41
-
-
Save BelegCuthalion/6bbc26f6ae67f5440f8de3a54029fad0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def determinant(matrix): | |
n = len(matrix) | |
if (n == 1): | |
return matrix[0][0] | |
else: | |
sum = 0 | |
for c in range(n): | |
sum += ((-1) ** c) * matrix[0][c] * \ | |
determinant([matrix[x][:c]+matrix[x][c+1:] for x in range(1, n)]) | |
return sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment