python中的Sympy解决方案不返回任何东西

时间:2019-03-25 00:42:41

标签: python sympy

我有3个方程式和3个未知数,我正在尝试使用sympy求解法求解。我有以下代码:

import math
from sympy import apart
from sympy.abc import x, y, z
from sympy import solve, symbols
x, y, z = symbols('x,y,z')

curr_location_x1=3
curr_location_y1=3
curr_location_z1=3

curr_location_x2=4
curr_location_y2=4
curr_location_z2=4

curr_location_x3=5
curr_location_y3=5
curr_location_z3=5

f_1=0.3
f_2=0.25
f_3=0.2

x_my=0.1
y_my=0.1
z_my=0.1

x_test=3.5
y_test=3.5
z_test=3.5
sol4=solve([math.log(f_3) + ((curr_location_x3-x_my)**2)/(2*(x**2)) + ((curr_location_y3-y_my)**2)/(2*(y**2)) + ((curr_location_z3-z_my)**2)/(2*(z**2)),math.log(f_2) + ((curr_location_x2-x_my)**2)/(2*(x**2)) + ((curr_location_y2-y_my)**2)/(2*(y**2)) + ((curr_location_z2-z_my)**2)/(2*(z**2)),math.log(f_1) + ((curr_location_x1-x_my)**2)/(2*(x**2)) + ((curr_location_y1-y_my)**2)/(2*(y**2)) + ((curr_location_z1-z_my)**2)/(2*(z**2)) ], [x, y, z])
print(sol4)

`

但是,当我尝试运行此命令并打印sol4时,我什么也没得到,只是'[]'。我不明白为什么,因为我仔细检查了一下功能,它是正确的。

0 个答案:

没有答案