Para a disciplina de Álgebra Linear e Matricial por Ronan Soares
Adiciona a coluna $b$ em $A$
modifica o sistema sem modificar o conjunto solução
Substituir uma linha por uma combinação linear dela com outras linhas...
Dá quase certo...
def elimina(Lj, Li, pivo):
for k in range(len(Lj)):
Lj[k] = Lj[k] - pivo * Li[k]
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
def escalona(M, m, n):
i = 0
j = 0
while i < m - 1 and j < n:
k = i + 1
if M[i][j] == 0:
return "Erro"
else:
while k <= m - 1 and k <= n - 1:
elimina(M[k], M[i], M[i][j])
k = k + 1
i = i + 1
j = j + 1
return M
Resultado