torch.special.modified_bessel_k0
function modified_bessel_k0<S extends Shape>(input: Tensor<S, 'float32'>, _options?: SpecialUnaryOptions<S>): Tensor<S, 'float32'>Computes the modified Bessel function of the second kind of order 0, K₀(x).
Modified Bessel functions K₀ and K₁ are solutions to the modified Bessel differential equation x²y'' + xy' - (x² + n²)y = 0 (note the minus sign before n²). Unlike regular Bessel functions J and Y which oscillate, K functions decay exponentially to zero as x→∞, making them ideal for potential problems in unbounded domains. K₀ is exponentially decaying and appears naturally in heat conduction, diffusion, and electrostatics. Essential for:
- Heat conduction: steady-state in unbounded cylindrical domains (exponential decay crucial)
- Electrostatics: potential from cylindrical charge distribution in 3D space
- Stokes flow: viscous flow around cylinders (exponential far-field decay)
- Image processing: Gaussian filtering approximations (K₀ similar to Gaussian)
- Communications: special filter designs and signal analysis
- Quantum field theory: propagators in dimensional reduction (appears naturally)
Key Properties:
- K₀(0) = ∞ (logarithmic singularity, like Y functions)
- Exponentially decaying: K₀(x) ~ √(π/(2x)) exp(-x) for large x
- K₀(x) > 0 for all x > 0 (always positive)
- Related to exponentially scaled modified Bessel: K₀(x) ≈ i0(x) - modified counterpart
- General modified Bessel solution: y = C₁I₀(x) + C₂K₀(x)
- Wronskian: I₀(x)K₀'(x) - I₀'(x)K₀(x) = -1/x
- Second kind: K₀ is the "second kind" modified Bessel (unbounded at origin)
- Exponential decay: K₀(x) ~ exp(-x)/√x, crucial for decay in radiation problems
- Positive function: K₀(x) 0 for all x 0 (unlike Y₀ which oscillates)
- General solution: Any solution to modified Bessel ODE: C₁I₀(x) + C₂K₀(x)
- Wronskian: I₀K₀' - I₀'K₀ = -1/x (fundamental relation with I₀)
- Integral form: K₀(x) = ∫₀^∞ exp(-x cosh(t)) dt (useful for analysis)
- Fourier pair: K₀ related to Bessel K through Fourier transforms
- Domain x 0 only: Undefined for x ≤ 0, singular at x=0
- Singularity at origin: K₀(0) = ∞ (like Y₀ but with different behavior)
- Numerical underflow: For large x, K₀(x) underflows rapidly
- Large x: Use scaled_modified_bessel_k0 for numerical stability
Parameters
inputTensor<S, 'float32'>- Input tensor with positive real values x 0 (undefined at x=0)
_optionsSpecialUnaryOptions<S>optional
Returns
Tensor<S, 'float32'>– Tensor with K₀(x) values (exponentially decaying from ∞)Examples
// Exponential decay: singularity at origin, rapid decay for large x
const x = torch.tensor([0.1, 0.5, 1, 2, 5]);
const k0 = torch.special.modified_bessel_k0(x); // [2.427, 0.928, 0.421, 0.114, 0.0037]
// K₀(0.1)→very large, K₀(5)→nearly zero (exponential tail)// Heat conduction in unbounded cylinder
const r = torch.linspace(0.01, 10, 200); // Radial distance from heat source
const temperature = torch.special.modified_bessel_k0(r); // Steady-state temperature
// Decays exponentially to ambient temperature at large distances// Electrostatic potential: point charge in cylindrical configuration
const distance = torch.linspace(0.1, 5, 100); // Distance from source
const potential = torch.special.modified_bessel_k0(distance);
// Represents Green's function for Laplace equation in specific geometry// Gaussian approximation: K₀ related to Gaussian filtering
const x = torch.linspace(0, 5, 100);
const gaussian = torch.exp(x.pow(2).mul(-0.5));
const bessel_k0 = torch.special.modified_bessel_k0(x);
// Both exhibit smooth exponential decay, related approximationsSee Also
- PyTorch torch.special.modified_bessel_k0()
- torch.special.modified_bessel_i0 - First kind order 0 (growing exponentially)
- torch.special.scaled_modified_bessel_k0 - Scaled K₀ for numerical stability
- torch.special.bessel_y0 - Regular second kind (oscillates vs decays)