Reputation: 1
I was wondering to check for an algorithm that would solve set of three linear equations in two variables which change in every equation adjacently for example
I am open to all suggestions
Upvotes: 0
Views: 98
Reputation: 366
alternative to the answer
import numpy as np
A = np.array([[1, 1, 0], [1, 0, 1], [0, 1, 1]])
B = np.array([0, 0, 1])
X = np.linalg.inv(A).dot(B)
print(X)
Upvotes: 0
Reputation: 559
Use the np.linalg.solve library:
https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
import numpy as np
a = np.array([[1,1,0], [1,0,1], [0,1,1]])
b = np.array([0,0,1])
x = np.linalg.solve(a, b)
Upvotes: 1