Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Nome: Laplace_Det
- Função: Encontrar o determinante de matrizes utilizando o método de Laplace
- Autor: Állan Rocha
- Data: 9/8/2017
- """
- def laplace_method(smatriz):
- """
- Função que resolve matrizes usando o método de Laplace
- """
- if len(smatriz[0]) == 2:
- det = smatriz[0][0] * smatriz[1][1] - (smatriz[0][1] * smatriz[1][0])
- return det
- equation = 0
- for line in smatriz:
- signal = ((-1) ** (smatriz.index(line) + 2))
- sub_matriz = []
- for next_line in smatriz:
- if next_line != line:
- sub_matriz.append(next_line[1:])
- equation += signal * line[0] * laplace_method(MATRIZ)
- return equation
- VALUES = input("Digite o valor das matrizes separadando suas linhas com \",\":").split(",")
- MATRIZ = []
- for value in VALUES:
- MATRIZ.append([int(k) for k in value.split(" ") if k != ""])
- print(laplace_method(VALUES))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement