我有三个方程和三个未知数,我想用sympy solve来解。我有以下代码:
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时,我什么也得不到,只有'[]'。我不明白为什么,因为我仔细检查了函数,它是正确的
目前没有回答
相关问题 更多 >
编程相关推荐