scipy.special.

riccati_yn#

scipy.special.riccati_yn(n, x)[source]#

Compute Riccati-Bessel function of the second kind and its derivative.

The Riccati-Bessel function of the second kind is defined here as \(+x y_n(x)\), where \(y_n\) is the spherical Bessel function of the second kind of order \(n\). Note that this is in contrast to a common convention that includes a minus sign in the definition.

This function computes the value and first derivative of the function for all orders up to and including n.

Parameters:
nint

Maximum order of function to compute

xfloat

Argument at which to evaluate

Returns:
ynndarray

Value of y0(x), …, yn(x)

ynpndarray

First derivative y0’(x), …, yn’(x)

Notes

The computation is carried out via ascending recurrence, using the relation DLMF 10.51.1 [2].

Wrapper for a Fortran routine created by Shanjie Zhang and Jianming Jin [1].

References

[1]

Zhang, Shanjie and Jin, Jianming. “Computation of Special Functions”, John Wiley and Sons, 1996. https://people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html

[2]

NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/10.51.E1

Examples

In practical applications, frequently the logarithmic derivative of the Riccati-Bessel functions is needed. We determine the logarithmic derivative of the Riccati-Bessel function of the second kind for order 5 and argument 1.2. The logarithmic derivative is obtained by dividing the derivative of the Riccati-Bessel function by the Riccati-Bessel function itself.

>>> from scipy.special import riccati_yn
>>> n = 5
>>> z = 1.2
>>> chi_n, chi_n_p = riccati_yn(n, z)
>>> chi_n
array([-3.62357754e-01, -1.23400388e+00, -2.72265195e+00, -1.01103792e+01,
       -5.62545603e+01, -4.11798823e+02])
>>> chi_n_p
array([9.32039086e-01, 6.65978813e-01, 3.30374937e+00, 2.25532961e+01,
       1.77404822e+02, 1.65957387e+03])
>>> chi_n_p[5]/chi_n[5]
np.float64(-4.030059767479337)

Alternatively, the logarithmic derivative of the Riccati-Bessel functions could be obtained from the corresponding spherical Bessel functions by making use of the definition of the Riccati-Bessel function in terms of the spherical Bessel function as given above.

>>> from scipy.special import spherical_yn
>>> yn = spherical_yn(n, z)
>>> ynp = spherical_yn(n, z, derivative=True)
>>> ynp/yn + 1/z
np.float64(-4.030059767479337)