In the code below, Is result not supposed to be the same as eqtn_ans[1] since numpy had no problem solving the simultaneous equation? Or I'm I missing something?
Since numpy was able to get the inverse of eqtn_coeffs doesn't that make the equation solvable?
import numpy as np
def solve_simultaneous_equation(eq_coef, ans):
A = np.array(eq_coef)
B = np.array(ans)
E = np.linalg.solve(A,B)
return E
eqtn_coeffs = [[0.13230431079864502, -0.4504314661026001, 0.6201357841491699],
[-0.04826474189758301, -0.4006437063217163, 1.5354962348937988],
[-0.22883379459381104, -0.3508559465408325, 2.4508566856384277]]
eqtn_ans = [0.0, 0.7853981852531433, 1.3258177042007446]
params = solve_simultaneous_equation(eqtn_coeffs, eqtn_ans)
result = np.dot(eqtn_coeffs[1],params)
print(result) # The result of this should be the same as eqtn_ans[1]
# but its not even though numpy was able to solve the equation.
result:
0.625