我推导出了一些带有一些变量的方程。我想解决一个未知变量。我正在使用 Sympy。我的代码如下:
import sympy as syp
import math as m
#this is the unknown variable that I want to find
C0 = syp.Symbol('C0')
#Known variables
D0 = 0.874
theta2 = 10.0
fi2 = 80.0
theta1 = (theta2/180.0)*m.pi
fi1 = (fi2/180.0)*m.pi
#Definitions of 6 different equations all of them in respect to CO.
C_t = 5*m.pi*(D0+4*C0)
St123 = 1.5*theta1*(D0+2*C0)
St45 = fi1*(D0+7*C0)
l1 = syp.sqrt((0.5*(D0+4*C0)-0.5*D0*m.cos(theta1))**2 + (0.5*D0*m.sin(theta1))**2)
l2 = syp.sqrt((0.5*(D0+6*C0)-0.5*(D0+2*C0)*m.cos(theta1))**2 + (0.5*(D0+2*C0)*m.sin(theta1))**2)
l3 = syp.sqrt((0.5*(D0+8*C0)-0.5*(D0+4*C0)*m.cos(theta1))**2 + (0.5*(D0+4*C0)*m.sin(theta1))**2)
#Definition of the general relationship between the above functions. Here C0 is unknown and C_b
C_b = C_t + 6*C0 + 3*(l1+l2+l3) - 3*St123 - 3*St45
#for C_b = 10.4866, find C0
syp.solve(C_b - 10.4866, C0)
正如所观察到的,我想解决 C_b 与 C0 的关系。直到最后一行我的代码工作正常。当我运行整个脚本时,计算 C0 似乎需要很长时间。我没有任何警告信息,但我也没有任何解决方案。有人会提出替代方案或可能的解决方案吗?提前非常感谢。