我正在尝试使用 scipy.special 库中的超几何汇合函数来定义此函数:
def Fl(x,l,p):
F=sc.hyp1f1(l+1-(1j*p),2*(l+1),-2*1j*x)
s=sc.gamma(l+1+(1j*p))/math.gamma(2*(l+1))
d=cmath.exp((math.pi*p)/2)*(2**l)*(x**(l+1))*cmath.exp((1j*x)+(1j*sigl(l)))
F1=F*s*d
return F1
但是出现错误:
36 def Fl(x,l,p):
---> 37 F=sc.hyp1f1(l+1-(1j*p),2*(l+1),-2*1j*x)
38 s=sc.gamma(l+1+(1j*p))/math.gamma(2*(l+1))
39 d=cmath.exp((math.pi*p)/2)*(2**l)*(x**(l+1))*cmath.exp((1j*x)+(1j*sigl(l)))
TypeError: ufunc 'hyp1f1' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
有人可以帮我找出问题所在吗?这个函数应该接受什么样的输入?
hyp1f1
仅接受实值a
和b
(第三个参数x
,可以很复杂),请参阅https://docs.scipy.org/doc/scipy/reference/ generated/ scipy.special.hyp1f1.html
In [1]: from scipy.special import hyp1f1
In [2]: hyp1f1(1, 2, 1j)
Out[2]: (0.8414709848078965+0.45969769413186023j)
In [3]: hyp1f1(1j, 2, 1j)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 hyp1f1(1j, 2, 1j)
TypeError: ufunc 'hyp1f1' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''