Question: Why is my following code not showing the correct roots of the system of linear equations? The code must be done using naive gaussian elimination.
Why is my following code not showing the correct roots of the system of linear equations? The code must be done using naive gaussian elimination. The roots should be [0.5,8,-6]

code:
import numpy as np from time import time
A = np.matrix('10 2 -1 ; -3 -6 2 ; 1 1 5') b = np.matrix('27 ; -61.5 ; -21.5') x2 = np.linalg.solve(A,b) epsilon = np.finfo(np.float64).eps
def My_GE_ForLoops(A,b): (n,m) = A.shape if n!= m: return 'A must be square' A = A.copy() b = b.copy() for k in range(0, n-1): if abs(A[k,k])
x1, x2, x3 = My_GE_ForLoops(A,b)
print(x1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
