besselj
besselj(nu, x)
Bessel function of the first kind of order nu, $J_\nu(x)$.
Examples
The besselj(nu, x) function in Julia computes the Bessel function of the first kind of order nu, denoted as J_ν(x). Here are some examples of how to use this function:
-
Compute Bessel function for integer order:
julia> besselj(2, 3.5) 0.09215483151435986This example calculates
J₂(3.5). -
Evaluate Bessel function for non-integer order:
julia> besselj(0.5, 2.5) 0.730079727800156It computes
J₀.₅(2.5). - Evaluate Bessel function for an array of
xvalues:julia> x = [1.0, 2.0, 3.0]; julia> besselj(1.5, x) 3-element Array{Float64,1}: 0.4482883573538264 -0.12776796356752983 -0.4979128360766848This example calculates
J₁.₅(x)for each element in the arrayx.
Common mistake example:
julia> besselj(1, -2)
ERROR: DomainError: Cannot evaluate Bessel function for negative `x`
In this case, a negative value of x is provided, which leads to a domain error. The Bessel function of the first kind is not defined for negative x values. To avoid this error, ensure that the x value is non-negative when using besselj.
See Also
besselh, besseli, besselix, besselj, besselj0, besselj1, besseljx, besselk, besselkx, bessely, bessely0, bessely1, besselyx, hankelh1, hankelh1x, hankelh2, hankelh2x,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.