我一直收到输入错误,但我不知道是哪个引起了问题。 我的代码是。。在
#import modules needed
from math import sin, pi, sqrt
from cmath import exp
from lab2_q4b import q
#Define constants
lamda=500e-6 #wavelength of the incident light, units in meter
n=10 #number of slits in a dffraction grating
f=1.0 #focal length, units in meter
x=0.1 #width of the screen, units in meter
#Define a new function called qnew, which will be our integrand
def qnew(u):
return sqrt(q)*exp(1j*2*pi*x*u/(lamda*f))
我运行这个它会给我错误。。在
这是q的代码。。在
^{pr2}$
问题在于
qnew
的这一段:在Isolation中运行这段代码将引发您看到的异常:
^{pr2}$q
是一个函数,所以你试图取函数的平方根,这当然没有意义。我不知道你想把它放在什么地方,但你需要修复的地方。在我想你应该把它改成:
相关问题 更多 >
编程相关推荐