scipy.special.

spherical_jn#

scipy.special.spherical_jn(n, z, derivative=False)[source]#

第一类球贝塞尔函数或其导数。

定义如下 [1],

\[j_n(z) = \sqrt{\frac{\pi}{2z}} J_{n + 1/2}(z),\]

其中 \(J_n\) 是第一类贝塞尔函数。

参数:
nint, array_like

贝塞尔函数的阶数 (n >= 0)。

zcomplex or float, array_like

贝塞尔函数的参数。

derivativebool, optional

如果为 True,则返回导数值(而不是函数本身)。

返回:
jnndarray

附注

对于大于阶数的实数参数,该函数使用递增递归 [2] 进行计算。对于小的实数或复数参数,使用定义关系与第一类圆柱贝塞尔函数相关联。

使用关系计算导数 [3],

\[ \begin{align}\begin{aligned}j_n'(z) = j_{n-1}(z) - \frac{n + 1}{z} j_n(z).\\j_0'(z) = -j_1(z)\end{aligned}\end{align} \]

0.18.0 版本新增。

参考文献

[AS]

Milton Abramowitz 和 Irene A. Stegun 编. 带有公式、图表和数学表格的数学函数手册。纽约:Dover,1972。

示例

第一类球贝塞尔函数 \(j_n\) 接受实数和复数第二参数。它们可以返回复数类型

>>> from scipy.special import spherical_jn
>>> spherical_jn(0, 3+5j)
(-9.878987731663194-8.021894345786002j)
>>> type(spherical_jn(0, 3+5j))
<class 'numpy.complex128'>

我们可以验证在区间 \([1, 2]\)\(n=3\) 的导数关系

>>> import numpy as np
>>> x = np.arange(1.0, 2.0, 0.01)
>>> np.allclose(spherical_jn(3, x, True),
...             spherical_jn(2, x) - 4/x * spherical_jn(3, x))
True

具有实数参数的前几个 \(j_n\)

>>> import matplotlib.pyplot as plt
>>> x = np.arange(0.0, 10.0, 0.01)
>>> fig, ax = plt.subplots()
>>> ax.set_ylim(-0.5, 1.5)
>>> ax.set_title(r'Spherical Bessel functions $j_n$')
>>> for n in np.arange(0, 4):
...     ax.plot(x, spherical_jn(n, x), label=rf'$j_{n}$')
>>> plt.legend(loc='best')
>>> plt.show()
../../_images/scipy-special-spherical_jn-1.png