Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
inverse matrix gauss jordan
matrix = [[3, 2, 3, 3, 2, 1, 1, 2, 2, 3], # epafksimenos (augmented) pinakas 20x10 [2, 3, 1, 2, 1, 2, 3, 2, 2, 1], [2, 3, 1, 2, 1, 1, 1, 3, 2, 1], [1, 3, 2, 2, 1, 1, 3, 2, 1, 3], [3, 2, 2, 3, 1, 2, 2, 1, 1, 2], [2, 1, 3, 1, 2, 4, 2, 3, 2, 3], [3, 1, 1, 3, 3, 3, 1, 3, 1, 3], [3, 3, 3, 2, 1, 1, 2, 2, 2, 1], [3, 3, 1, 1, 1, 1, 1, 1, 3, 1], [1, 2, 1, 1, 3, 2, 1, 1, 2, 3], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0 ,1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]] def matrix_elimination(matrix): # pollaplasiazoume ta stoixeia tis 1hs grammis me ton antistrofo tou protou stoixeiou # afairoume tin 1h grammi apo tis ipoloipes (elimination) # epanalamvanoume tin parapano diadikasia i, k, m, n = 0, 0, 0, 20 while i < n / 2: j = 0 var = matrix[i][i] print ("var =", var, "", "i =", i) for e in matrix[i]: if var != 0: e = e * (1 / var) matrix[i][j] = e j = j + 1 # print ("matrix = ", matrix) m = k + 1 print ("m =", m, "", "i =", i, "", "k =", k) while m < n / 2: var1 = matrix[m][i] print ("var1 =", var1) k = i while k < n / 2: matrix[m][k] = matrix[m][k] - (matrix[i][k] * var1 ) k = k + 1 m = m + 1 k = 0 k = k + 1 i = i + 1 print (*matrix, sep = "\n") return matrix inverse_matrix = matrix_elimination(matrix) print ("inverse_matrix =",inverse_matrix)
run
|
edit
|
history
|
help
0
gj3
sainik
Test
Prac
Mengira luas dan perimeter segi tiga
Palindrome using recursion
Rishika
Python code
khud ki kalakari
Python