我正在尝试使用 Scipy 模块在 Python 中绘制绘图。根据http://docs.scipy.org/doc/scipy/reference/special.html我写了代码scipy.special.spherical_jn(n,x,0)
:
import matplotlib.pyplot as plt
import numpy as np
import scipy.special as sp
from matplotlib import rcParams
rcParams.update({'figure.autolayout': True})
def odrazTE(a,o,d):
temp1 = sp.spherical_jn[1,a,0]
temp2 = 1
return abs(temp1/temp2)**2
t = np.arange(0.001, 2, 0.001)
plt.plot(t,odrazTE(t,t,1),label='TE1')
plt.show()
在编译程序时,我得到的只是这个错误:
Traceback (most recent call last):
File "standing-sphere.py", line 33, in <module>
plt.plot(t,odrazTE(t,t,1),label='TE1')
File "standing-sphere.py", line 15, in odrazTE
temp1 = sp.spherical_jn[1,a,0]
AttributeError: 'module' object has no attribute 'spherical_jn'
有办法用常规贝塞尔函数以及贝塞尔和球贝塞尔函数之间的关系来做到这一点,但由于 sph.bess 的导数,我不喜欢这个解决方案。我也需要的功能。
有没有可能我设置错误并且可以将其修复为 scipy.special.spherical_jn 工作?