scipy.special.yve#
- scipy.special.yve(v, z, out=None) = <wrapped_ufunc 'yve'>#
Exponentially scaled Bessel function of the second kind of real order.
Returns the exponentially scaled Bessel function of the second kind of real order v at complex z:
yve(v, z) = yv(v, z) * exp(-abs(z.imag))
- Parameters:
- varray_like
Order (float).
- zarray_like
Argument (float or complex).
- outndarray, optional
Optional output array for the function results
- Returns:
- Yscalar or ndarray
Value of the exponentially scaled Bessel function.
See also
yvUnscaled Bessel function of the second kind of real order.
Notes
For positive v values, the computation is carried out using the AMOS [1] zbesy routine, which exploits the connection to the Hankel Bessel functions \(H_v^{(1)}\) and \(H_v^{(2)}\),
\[Y_v(z) = \frac{1}{2\imath} (H_v^{(1)} - H_v^{(2)}).\]For negative v values the formula,
\[Y_{-v}(z) = Y_v(z) \cos(\pi v) + J_v(z) \sin(\pi v)\]is used, where \(J_v(z)\) is the Bessel function of the first kind, computed using the AMOS routine zbesj. Note that the second term is exactly zero for integer v; to improve accuracy the second term is explicitly omitted for v values such that v = floor(v).
Exponentially scaled Bessel functions are useful for large z: for these, the unscaled Bessel functions can easily under-or overflow.
Array API Standard Support
yvehas support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
⛔
PyTorch
✅
⛔
JAX
✅
⛔
Dask
✅
n/a
For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support
out, but typically none of the other ufunc kwargs.outis typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend.outis never supported for JAX because JAX arrays are immutable.yvedoes not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
References
[1]Donald E. Amos, “AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order”, http://netlib.org/amos/
Examples
Compare the output of
yvandyvefor large complex arguments for z by computing their values for orderv=1atz=1000j. We see thatyvreturns nan butyvereturns a finite number:>>> import numpy as np >>> from scipy.special import yv, yve >>> v = 1 >>> z = 1000j >>> yv(v, z), yve(v, z) ((nan+nanj), (-0.012610930256928629+7.721967686709076e-19j))
For real arguments for z,
yvereturns the same asyvup to floating point errors.>>> v, z = 1, 1000 >>> yv(v, z), yve(v, z) (-0.02478433129235178, -0.02478433129235179)
The function can be evaluated for several orders at the same time by providing a list or NumPy array for v:
>>> yve([1, 2, 3], 1j) array([-0.20791042+0.14096627j, 0.38053618-0.04993878j, 0.00815531-1.66311097j])
In the same way, the function can be evaluated at several points in one call by providing a list or NumPy array for z:
>>> yve(1, np.array([1j, 2j, 3j])) array([-0.20791042+0.14096627j, -0.21526929+0.01205044j, -0.19682671+0.00127278j])
It is also possible to evaluate several orders at several points at the same time by providing arrays for v and z with broadcasting compatible shapes. Compute
yvefor two different orders v and three points z resulting in a 2x3 array.>>> v = np.array([[1], [2]]) >>> z = np.array([3j, 4j, 5j]) >>> v.shape, z.shape ((2, 1), (3,))
>>> yve(v, z) array([[-1.96826713e-01+1.27277544e-03j, -1.78750840e-01+1.45558819e-04j, -1.63972267e-01+1.73494110e-05j], [1.94960056e-03-1.11782545e-01j, 2.02902325e-04-1.17626501e-01j, 2.27727687e-05-1.17951906e-01j]])