scipy.special.

spherical_in#

scipy.special.spherical_in(n, z, derivative=False)[源代码]#

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

定义为 [1]

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

其中 \(I_n\) 是第一类修正贝塞尔函数。

参数:
nint (整数), array_like (类数组)

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

zcomplex (复数) or float (浮点数), array_like (类数组)

贝塞尔函数的自变量。

derivativebool (布尔值), optional (可选)

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

返回:
inndarray (ndarray 数组)

说明

该函数是根据其与第一类修正柱贝塞尔函数的定义关系计算的。

导数是使用关系式 [2] 计算的,

\[ \begin{align}\begin{aligned}i_n' = i_{n-1} - \frac{n + 1}{z} i_n.\\i_1' = i_0\end{aligned}\end{align} \]

0.18.0 版本新增。

参考文献

[AS]

Milton Abramowitz 和 Irene A. Stegun,编。《数学函数手册,包含公式、图表和数学表格》。纽约:Dover,1972。

示例

第一类修正球贝塞尔函数 \(i_n\) 接受实数和复数作为第二个参数。它们可以返回复数类型

>>> from scipy.special import spherical_in
>>> spherical_in(0, 3+5j)
(-1.1689867793369182-1.2697305267234222j)
>>> type(spherical_in(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_in(3, x, True),
...             spherical_in(2, x) - 4/x * spherical_in(3, x))
True

前几个以实数为自变量的 \(i_n\)

>>> import matplotlib.pyplot as plt
>>> x = np.arange(0.0, 6.0, 0.01)
>>> fig, ax = plt.subplots()
>>> ax.set_ylim(-0.5, 5.0)
>>> ax.set_title(r'Modified spherical Bessel functions $i_n$')
>>> for n in np.arange(0, 4):
...     ax.plot(x, spherical_in(n, x), label=rf'$i_{n}$')
>>> plt.legend(loc='best')
>>> plt.show()
../../_images/scipy-special-spherical_in-1.png