scipy.special.jv#
- scipy.special.jv(v,z,out=None)=<ufunc'jv'>#
Bessel function of the first kind of real order and complex argument.
- Parameters:
- varray_like
Order (float).
- zarray_like
Argument (float or complex).
- outndarray, optional
Optional output array for the function values
- Returns:
- Jscalar or ndarray
Value of the Bessel function,\(J_v(z)\).
See also
jve\(J_v\) with leading exponential behavior stripped off.
spherical_jnspherical Bessel functions.
j0faster version of this function for order 0.
j1faster version of this function for order 1.
Notes
For positivev values, the computation is carried out using the AMOS[1]zbesj routine, which exploits the connection to the modifiedBessel function\(I_v\),
\[ \begin{align}\begin{aligned}J_v(z) = \exp(v\pi\imath/2) I_v(-\imath z)\qquad (\Im z > 0)\\J_v(z) = \exp(-v\pi\imath/2) I_v(\imath z)\qquad (\Im z < 0)\end{aligned}\end{align} \]For negativev values the formula,
\[J_{-v}(z) = J_v(z) \cos(\pi v) - Y_v(z) \sin(\pi v)\]is used, where\(Y_v(z)\) is the Bessel function of the secondkind, computed using the AMOS routinezbesy. Note that the secondterm is exactly zero for integerv; to improve accuracy the secondterm is explicitly omitted forv values such thatv = floor(v).
Not to be confused with the spherical Bessel functions (see
spherical_jn).References
[1]Donald E. Amos, “AMOS, A Portable Package for Bessel Functionsof a Complex Argument and Nonnegative Order”,http://netlib.org/amos/
Examples
Evaluate the function of order 0 at one point.
>>>fromscipy.specialimportjv>>>jv(0,1.)0.7651976865579666
Evaluate the function at one point for different orders.
>>>jv(0,1.),jv(1,1.),jv(1.5,1.)(0.7651976865579666, 0.44005058574493355, 0.24029783912342725)
The evaluation for different orders can be carried out in one call byproviding a list or NumPy array as argument for thev parameter:
>>>jv([0,1,1.5],1.)array([0.76519769, 0.44005059, 0.24029784])
Evaluate the function at several points for order 0 by providing anarray forz.
>>>importnumpyasnp>>>points=np.array([-2.,0.,3.])>>>jv(0,points)array([ 0.22389078, 1. , -0.26005195])
Ifz is an array, the order parameterv must be broadcastable tothe correct shape if different orders shall be computed in one call.To calculate the orders 0 and 1 for a 1D array:
>>>orders=np.array([[0],[1]])>>>orders.shape(2, 1)
>>>jv(orders,points)array([[ 0.22389078, 1. , -0.26005195], [-0.57672481, 0. , 0.33905896]])
Plot the functions of order 0 to 3 from -10 to 10.
>>>importmatplotlib.pyplotasplt>>>fig,ax=plt.subplots()>>>x=np.linspace(-10.,10.,1000)>>>foriinrange(4):...ax.plot(x,jv(i,x),label=f'$J_{i!r}$')>>>ax.legend()>>>plt.show()
