How to determine which one is free variable in the result of sympy.linsolve

点点圈 提交于 2019-12-11 07:41:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!