我怎样才能得到这个给我 x = z*y/a ?
from sympy import *
x,y,a,z = symbols('x y a z')
z = a*x/y
solve(z,x) # returns 0!
# would like to get z*y/a
最佳答案
solve(z,x)
正确返回 0,因为您的代码有效地询问:
您真正想要做的(如 here 所述)是解决 a*x/y==z
,可以按如下方式完成:
from sympy import *
x,y,a,z = symbols('x y a z')
equation = a*x/y
new_eq = solve(equation - z, x) # its value is [y*z/a]
关于python - 求解变量方程,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35807919/