riccati_jn#
- scipy.special.riccati_jn(n, x)[source]#
Compute Riccati-Bessel function of the first kind and its derivative.
The Riccati-Bessel function of the first kind is defined as \(x j_n(x)\), where \(j_n\) is the spherical Bessel function of the first kind of order \(n\).
This function computes the value and first derivative of the Riccati-Bessel function for all orders up to and including n.
- Parameters:
- nint
Maximum order of function to compute
- xfloat
Argument at which to evaluate
- Returns:
- jnndarray
Value of j0(x), …, jn(x)
- jnpndarray
First derivative j0’(x), …, jn’(x)
Notes
The computation is carried out via backward 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 first 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_jn >>> n = 5 >>> z = 1.2 >>> psi_n, psi_n_p = riccati_jn(n, z) >>> psi_n array([9.32039086e-01, 4.14341484e-01, 1.03814624e-01, 1.82194479e-02, 2.46548893e-03, 2.71719094e-04]) >>> psi_n_p array([0.36235775, 0.58675452, 0.24131711, 0.058266 , 0.01000115, 0.00133333]) >>> psi_n_p[5]/psi_n[5] np.float64(4.9070016327063115)
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_jn >>> jn = spherical_jn(n, z) >>> jnp = spherical_jn(n, z, derivative=True) >>> jnp/jn + 1/z np.float64(4.907001632706311)