bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / special / _spherical_bessel / spherical_yn
function
scipy.special._spherical_bessel:spherical_yn
source: build-install/usr/lib/python3.14/site-packages/scipy/special/_spherical_bessel.py:98
Signature
def spherical_yn(n, z, derivative = False)Summary
Spherical Bessel function of the second kind or its derivative.
Extended Summary
Defined as [1],
where is the Bessel function of the second kind.
Parameters
n: int, array_likeOrder of the Bessel function (n >= 0).
z: complex or float, array_likeArgument of the Bessel function.
derivative: bool, optionalIf True, the value of the derivative (rather than the function itself) is returned.
Returns
yn: ndarrayValue or derivative of spherical Bessel function of the second kind.
Notes
For real arguments, the function is computed using the ascending recurrence [2]. For complex arguments, the definitional relation to the cylindrical Bessel function of the second kind is used.
The derivative is computed using the relations [3],
Examples
The spherical Bessel functions of the second kind :math:`y_n` accept both real and complex second argument. They can return a complex type:from scipy.special import spherical_yn
✓spherical_yn(0, 3+5j)
✗np.complex128(8.022343088587196-9.880052589376795j)
type(spherical_yn(0, 3+5j))
✓<class 'numpy.complex128'>We can verify the relation for the derivative from the Notes for :math:`n=3` in the interval :math:`[1, 2]`:
import numpy as np x = np.arange(1.0, 2.0, 0.01) np.allclose(spherical_yn(3, x, True), spherical_yn(2, x) - 4/x * spherical_yn(3, x))✓
TrueThe first few :math:`y_n` with real argument:
import matplotlib.pyplot as plt x = np.arange(0.0, 10.0, 0.01) fig, ax = plt.subplots()✓
ax.set_ylim(-2.0, 1.0) ax.set_title(r'Spherical Bessel functions $y_n$') for n in np.arange(0, 4): ax.plot(x, spherical_yn(n, x), label=rf'$y_{n}$') plt.legend(loc='best')✗
<matplotlib.legend.Legend object at 0x7f3f58a04c20>
plt.show()
✓
Aliases
scipy.special.spherical_yn