问题
I want to solve the linear equation for n given points in n dimensional space to get the equation of hyper-plane.
for example, in two dimensional case, Ax + By + C = 0
.
How can I get one solution if there are infinite solutions in a linear equations ?
I have tried scipy.linalg.solve()
but it requires coefficient matrix A to be nonsingular.
I also tried sympy
A = Matrix([[0, 0, 1], [1, 1, 1]])
b = Matrix([0, 0])
linsolve((A, b), [x, y, z])
It returned me this
{(−y,y,0)}
I have to parse the result to determine which one is the free variable and then assign a number to it to get a solution.
Is there a more convenient way since I only want to get a specific solution ?
来源:https://stackoverflow.com/questions/50510558/how-to-determine-which-one-is-free-variable-in-the-result-of-sympy-linsolve