torch.special.bessel_j0
function bessel_j0<S extends Shape>(input: Tensor<S, 'float32'>, _options?: SpecialUnaryOptions<S>): Tensor<S, 'float32'>Computes the Bessel function of the first kind of order 0, J₀(x).
J₀(x) appears as solutions to many differential equations in physics and engineering, particularly in cylindrical coordinate systems. Unlike trigonometric functions that apply to Cartesian geometry, J₀ is the "natural" oscillating function for problems with cylindrical symmetry. Essential for:
- Vibrations and acoustics: circular drums, pipes, cylindrical structures
- Electromagnetic waves: TM modes in circular waveguides, antenna radiation
- Heat conduction: temperature diffusion in cylindrical geometries
- Quantum mechanics: angular momentum eigenfunctions (l=0 partial waves)
- Signal processing: windowing functions, filter design (Bessel filters)
- Optics: diffraction patterns (Airy disk), Bessel beams
- Fluid dynamics: viscous flow around cylinders (Stokes' equations)
Key Properties:
- J₀(0) = 1, J₀(x) → 0 as x → ∞
- Oscillatory with decreasing amplitude: max ≈ 1, min ≈ -0.4
- First zero ≈ 2.405, second ≈ 5.520, zeros spaced ~π apart for large x
- Related to ordinary sine/cosine via asymptotic expansion
- Satisfies recurrence: (2n/x)Jₙ = Jₙ₋₁ + Jₙ₊₁
- Orthogonality: ∫₀^a J₀(αᵢa)J₀(αⱼa)x dx = 0 for i≠j (generalized Fourier series basis)
- Order 0: J₀ is the most commonly used order; J₁, J₂ for higher orders
- Orthogonal basis: J₀ functions form complete orthogonal set on [0, R]
- Even function: J₀(-x) = J₀(x), symmetric about x=0
- Asymptotic: Resembles cos(x) for large x with 1/√x damping
- Zeros: Irregularly spaced initially, then ~π apart for large indices
- Recurrence relation: 2J₁(x)/x = J₀'(x) = -J₁(x) (derivative relationship)
- Generating function: exp(x(t+1/t)/2) = Σ Jₙ(x)tⁿ (for all orders)
- Large x: Amplitude decreases as 1/√x, needs scaling for numerical accuracy
- Zeros become dense: For |x|100, zeros cluster with period ~π (hard to distinguish)
- Small x precision: Very small x needs special handling for J₀(x)≈1
- Oscillations: Rapid oscillations for large x demand fine sampling
Parameters
inputTensor<S, 'float32'>- Input tensor with real values x ≥ 0 (can be negative, even functions)
_optionsSpecialUnaryOptions<S>optional
Returns
Tensor<S, 'float32'>– Tensor with J₀(x) values (oscillating from 1 to 0 as x increases)Examples
// Basic oscillatory behavior
const x = torch.tensor([0, 1, 2.405, 5.520, 8.654]); // Include zeros
const j0 = torch.special.bessel_j0(x); // [1, 0.765, ≈0, -0.176, ≈0]
// J₀(0)=1, decays with oscillations as x increases// Circular drum vibration: modal analysis
const radius = 1.0; // Drum radius
const frequencies = torch.arange(1, 5).float().mul(2.405 / radius); // Natural frequencies
const radii = torch.linspace(0, radius, 50); // Radial positions
for (let k = 0; k < 3; k++) {
const mode_k = torch.special.bessel_j0(radii.mul(frequencies[k] / radius));
// Each mode is J₀ with different scaling, orthogonal over drum surface
}// TM mode in circular waveguide (electromagnetic)
const rho = torch.linspace(0, 1, 100); // Normalized radius
const c = 2.405; // First zero of J₀
const field = torch.special.bessel_j0(rho.mul(c)); // Radial field component
// Field vanishes at boundary (ρ=1), matches boundary conditions// Bessel filter design: windowing/smoothing in signal processing
const t = torch.linspace(-5, 5, 100); // Time axis
const alpha = 2.0; // Shape parameter
const window = torch.special.bessel_j0(alpha * t.pow(2).rsqrt().mul(-1).add(2));
// Smooth transition window with Bessel oscillations// Diffraction pattern: Airy disk intensity for circular aperture
const rho = torch.linspace(0, 4, 200); // Diffraction radius coordinate
const intensity = torch.special.bessel_j0(rho).pow(2); // Airy intensity pattern
// Central bright spot followed by oscillating rings (diffraction rings)See Also
- PyTorch torch.special.bessel_j0()
- torch.special.bessel_j1 - First-order Bessel (order 1)
- torch.special.bessel_y0 - Second kind order 0 (complementary)
- torch.special.i0 - Modified Bessel order 0 (I₀, related to J₀(ix))
- torch.special.airy_ai - Similar oscillatory function for different equation