Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # | a11 a21 . . . an1 | | x1 | | b1 |
- # | . . . . . . | | . | | . |
- # | . . . . . . | \/ | . | -- | . |
- # | . . . . . . | /\ | . | -- | . |
- # | . . . . . . | | . | | . |
- # | a1n a2n . . . ann | | xn | | bn |
- # | a11 a21 . . . a'n1 | | x1 | | b1 |
- # | 0 a'22 . . . . | | . | | . |
- # | 0 0 . . . . | \/ | . | -- | . |
- # | 0 0 . . . . | /\ | . | -- | . |
- # | 0 0 . . a'n-1n-1 . | | . | | . |
- # | 0 0 . . 0 a'nn | | xn | | bn |
- matrix = [[-1, 2, 1],
- [ 1, -3, -2],
- [ 3, -1, -1]]
- bees = [-1, -1, 4]
- n = len(matrix)
- for row in range(1, n):
- fraction = matrix[row][0] / matrix[0][0]
- bees[row] -= fraction*bees[0]
- for col in range(n):
- matrix[row][col] -= fraction * matrix[0][col]
- print(matrix)
- print(bees)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement