应该等同于
g(theta) - f(r) + (2 * Delta_T * sp.log(r) * (S_xx + S_yy) + Delta_T * sp.cos(2 * theta) * (S_yy - S_xx)) / (4 * sp.log(ro / ri))
(我不确定可能有一个负号差异,但这并不重要,因为这些表达式应该值得0)
这意味着我应该能够与
r
分开。或者,用Sympy的话来说,是从
theta
r
,但我无法进步。我尝试了一种方法,没有利用。
例如
sin(theta)**2, cos(2*theta)
Yieldscollect()
我们看到带有r平方的术语用
expr_collected = sp.collect(V_r_integral - V_theta_integral, [r, sp.cos(theta)**2, sp.sin(theta)**2])
乘以术语。与相同
Delta_T*(S_xx*ri**2*ro**2 - S_yy*ri**2*ro**2 + r**4*(-S_xx + S_yy) + r**2*(-S_xx*ri**2 - S_xx*ro**2 + S_yy*ri**2 + S_yy*ro**2))*cos(2*theta)/(4*r**2*(ri**2 + ro**2)*log(ro/ri)) - f(r) + g(theta) + (Delta_T*(S_xx + S_yy)*(ri**2 + ro**2)*log(r) + r**2*(Delta_T*S_xx/2 - Delta_T*S_yy/2 - (Delta_T*S_xx - Delta_T*S_yy)*sin(theta)**2) + (-Delta_T*S_xx*ri**2*ro**2/2 + Delta_T*S_yy*ri**2*ro**2/2 - (-2*Delta_T*S_xx*ri**2*ro**2 + 2*Delta_T*S_yy*ri**2*ro**2)*sin(theta)**2/2)/r**2)/(2*ri**2*log(ro/ri) + 2*ro**2*log(ro/ri))
cos(2*theta)
最终,有效的是这3行代码:
expr_collected = sp.collect(V_r_integral - V_theta_integral, [r**2, sp.cos(theta)**2, sp.sin(theta)**2, sp.cos(2*theta)])`
是的,是的,手动收集所有术语,并手动使用三角标识。我不知道是否有一种更直接的方法。