Skip to content
fn

bessel_j0

→Tensor
bessel_j0(input: Tensor)

Bessel function of the first kind, order 0.

Computes J0(x)J_0(x), the regular-at-origin solution of Bessel's equation x2y′′+xy′+x2y=0x^2 y'' + x y' + x^2 y = 0 for order 0. Appears throughout wave propagation, optical diffraction (the Airy disk profile), and vibration of circular membranes.

Parameters

inputTensor
Input tensor; any floating-point dtype.

Returns

Tensor

J0(x)J_0(x) element-wise, same shape and dtype as input.

Notes

Series representation:

J0(x)=∑k=0∞(−1)k(k!)2(x2)2k.J_0(x) = \sum_{k=0}^\infty \frac{(-1)^k}{(k!)^2} \left(\frac{x}{2}\right)^{2k}.

The implementation uses the Abramowitz & Stegun §9.4 two-branch polynomial fit: a power series in (x/3)2(x/3)^2 for ∣x∣≤3|x| \le 3 and an asymptotic 2/(πx)cos⁡(x−π/4)⋅f(3/∣x∣)\sqrt{2/(\pi x)} \cos(x - \pi/4) \cdot f(3/|x|) form for ∣x∣>3|x| > 3. Accuracy is ≈10−7\approx 10^{-7} on the real line; a float64 input takes the Cephes double-precision series instead, with its first two zeros exact. J_0 is even, J0(0)=1J_0(0) = 1, and the function decays as 2/(πx)\sqrt{2/(\pi x)} for large x.

Examples

>>> import lucid
>>> from lucid.special import bessel_j0
>>> bessel_j0(lucid.tensor([0.0, 1.0, 5.0]))
tensor([1., 0.7652, -0.1776])
>>> bool(bessel_j0(lucid.tensor(2.4048)).abs() < 1e-4)  # the first zero
True