torch.special.airy_ai
function airy_ai<S extends Shape>(input: Tensor<S, 'float32'>, _options?: SpecialUnaryOptions<S>): Tensor<S, 'float32'>Computes the Airy function Ai(x), solution to the Airy differential equation.
The Airy function Ai(x) is a special function defined as a solution to the Airy differential equation d²y/dx² - xy = 0, appearing in wave equation solutions and quantum mechanics. Both Ai(x) and Bi(x) are solutions; Ai decays exponentially for large positive x. Essential for:
- Wave propagation in varying media (WKB approximation, rainbow caustics)
- Quantum mechanics: tunneling through potential barriers, quantum optics
- Vibration analysis: uniform cantilever beams under distributed loads
- Diffraction and optics: Fresnel integrals, diffraction near caustics
- Plasma physics and acoustics: wave propagation with linear gradients
- Numerical solutions: boundary layer problems, asymptotic analysis
Key Properties:
- Ai(0) ≈ 0.355, Ai'(0) ≈ -0.259 (specific numerical values)
- Oscillatory for x < 0 (negative argument region)
- Exponentially decaying for x > 0 (positive argument region)
- Related to Bessel and Hankel functions for real arguments
- Zeros accumulate: first zero ≈ -2.338, second ≈ -4.089, etc.
- Bi(x) complementary solution: grows for positive x (often also useful)
- Differential equation: Ai(x) solves d²y/dx² - xy = 0 exactly
- Complementary function: Bi(x) is other solution, grows exponentially for x0
- Argument region: Oscillatory for x0 (turning point region), exponentially decaying x0
- WKB connection: Airy functions bridge classical/quantum turning points in WKB
- Asymptotic form: For large |x|, decays ∝ exp(-(2/3)x^(3/2)) in positive domain
- Zeros: Infinite zeros, accumulating near x = -(3π/8)(4n+3)² for large n
- Relationship: Related to Bessel functions: Ai(x) = (1/π)√(x/3) * K₁/₃(2x^(3/2)/3)
- Large positive x: Underflows to zero due to exponential decay (use scaled versions)
- Turning points: Transition from oscillatory to exponential behavior near x=0
- Numerical stability: For large |x|, use asymptotic approximations or scaled variants
- Domain: All real values allowed, but numerical precision degraded for |x|20
Parameters
inputTensor<S, 'float32'>- Input tensor with real values x (any range, typically [-20, 20])
_optionsSpecialUnaryOptions<S>optional
Returns
Tensor<S, 'float32'>– Tensor with Airy Ai(x) values (oscillatory 0, decaying 0)Examples
// Basic Airy function evaluation
const x = torch.tensor([-2, -1, 0, 1, 2]);
const ai_x = torch.special.airy_ai(x); // Oscillatory for x<0, decaying for x>0
// x=-2: oscillates, x=0: ≈0.355, x=2: ≈0.0235// Wave propagation in parabolic potential (WKB approximation)
const energy = 1.0; // Particle energy
const x = torch.linspace(-5, 5, 100); // Position
const scaled_x = x.mul(2).pow(2/3).mul(energy.pow(-1/3)); // WKB scaling
const wavefunction = torch.special.airy_ai(scaled_x); // Tunneling probability
// Decays exponentially in classically forbidden region (E < V(x))// Quantum tunneling: probability in barrier region
const barrier_strength = 2.0; // Strength of potential step
const positions = torch.linspace(-3, 3, 50);
const ai_vals = torch.special.airy_ai(positions.mul(barrier_strength.pow(1/3)));
const tunneling_prob = ai_vals.pow(2).mean(); // Integrated tunneling probability
// Near x=0 (turning point), Airy function dominates transition region// Diffraction pattern near caustic (optical/wave focusing)
const aperture_coords = torch.linspace(-4, 4, 200);
const diffraction_pattern = torch.special.airy_ai(aperture_coords);
// Oscillations for negative (shadow region), decay for positive (lit region)
// Models rainbow caustics and diffraction at optical singularities// Beam deflection: uniform cantilever beam
const x_beam = torch.linspace(0, 10, 100); // Distance along beam
const load = 1.0; // Distributed load strength
const scaled = x_beam.mul(load.pow(1/3));
const deflection = torch.special.airy_ai(scaled); // Normalized deflection
// Decaying oscillations show bending moment distributionSee Also
- PyTorch torch.special.airy_ai()
- torch.special.bessel_j0 - Related oscillatory Bessel function
- torch.special.spherical_bessel_j0 - Spherical variant (different equation)
- torch.special.erfc - Similar asymptotic Gaussian tail