我试图找到下面的积分“final2”,我收到了这个错误:
"This can happen when it's not possible to detect zero in the coefficient domain. the domain of computation is RR[_X3,_X4,_X8,_X9,_X10]. Zero detection is guaranteed in this coefficient domain. This may indicate a bug in SymPy or the domain is user defined and doesn't implement zero detection properly"
我尝试使用simplify
和nsimplify
,但代码运行时间超过3天仍然没有得到任何答案。
集成的限制是否可能成为问题的根源,因为它们不是固定的?如果是这样的话,我该怎么办呢?有没有更好的库或命令我可以用它来解决这个问题?
from sympy import *
#Fist define the constants' values
e=1.6*10**-19
hbar=1.05*10**-34
mstar=9.1*10**-31
m=0.22*9.1*10**-31
ab=hbar**2/e**2
#Define variables
d, k, phi, theta ,q, w, Vgr, Vp= symbols('d k phi theta q w Vgr Vp')
#intermediate variables
ez1w=5.8 * (w**2-738.3**2)/(w**2-533**2)
et1w=5.35 * (w**2-745**2)/(w**2-744**2)
ez2w=5.8 * (w**2-659.3**2)/(w**2-888**2)
et2w=5.35 * (w**2-671.6**2)/(w**2-895**2)
eta1= sqrt(abs(ez1w*et1w))
eta2= sqrt(abs(ez2w*et2w))
alpha=0.5*eta1
ek=hbar**2*k**2/(2*m)
eq=hbar**2*q**2/(2*m)
nw=1/(exp(hbar*w/25.9)-1)
#Define D function
DIf=(pi**4)*((alpha*(q**2)*(d**2)*(pi**2+(alpha*q*d)**2)**2)*(((1-eta1**2)*alpha*q*d+eta1)*2*(alpha**2)*diff(ez1w,w)+((1-eta1**2)*alpha*q*d+eta1)*0.5*diff(et1w,w)))**-1
#temp1=qn+k*cos(theta)-m*v/hbar
#temp2=0.5*qn+m*(Vp-Vgr)/hbar
temp3=0.5*q+(m/hbar)*(Vp-Vgr)
#temp4=(2*mstar/ab)*(Dc*(nw+1)/temp2)
temp5=sqrt(1/m*(2*ek-0.5*eq+hbar*w)-Vp**2)
temp7=((Vp/q+hbar/(2*m))*1/Vgr-1/q)
#The scattering rate equation is defined as final2
final2=(2*m/ab)*DIf*(nw)*temp7/(temp3*temp5)
#Integration Limits
lower=hbar*q**2/(2*m)+k*q*hbar/m
upper=hbar*q**2/(2*m)-k*q*hbar/m
#Do the integration
print('Scattering Rate is given by:')
SR = integrate(final2, (w, lower, upper))