Airy functions¶
This module implements Airy functions and their generalized derivatives. It supports symbolic functionality through Maxima and numeric evaluation through mpmath and scipy.
Airy functions are solutions to the differential equation \(f''(x) - x f(x) = 0\).
Four global function symbols are immediately available, please see
- airy_ai(): for the Airy Ai function
- airy_ai_prime(): for the first differential of the Airy Ai function
- airy_bi(): for the Airy Bi function
- airy_bi_prime(): for the first differential
- of the Airy Bi function 
 
AUTHORS:
- Oscar Gerardo Lazo Arjona (2010): initial version 
- Douglas McNeil (2012): rewrite 
EXAMPLES:
Verify that the Airy functions are solutions to the differential equation:
sage: diff(airy_ai(x), x, 2) - x * airy_ai(x)                                       # needs sage.symbolic
0
sage: diff(airy_bi(x), x, 2) - x * airy_bi(x)                                       # needs sage.symbolic
0
>>> from sage.all import *
>>> diff(airy_ai(x), x, Integer(2)) - x * airy_ai(x)                                       # needs sage.symbolic
0
>>> diff(airy_bi(x), x, Integer(2)) - x * airy_bi(x)                                       # needs sage.symbolic
0
- class sage.functions.airy.FunctionAiryAiGeneral[source]¶
- Bases: - BuiltinFunction- The generalized derivative of the Airy Ai function. - INPUT: - alpha– return the \(\alpha\)-th order fractional derivative with respect to \(z\). For \(\alpha = n = 1,2,3,\ldots\) this gives the derivative \(\operatorname{Ai}^{(n)}(z)\), and for \(\alpha = -n = -1,-2,-3,\ldots\) this gives the \(n\)-fold iterated integral.
 \[ \begin{align}\begin{aligned}f_0(z) = \operatorname{Ai}(z)\\f_n(z) = \int_0^z f_{n-1}(t) dt\end{aligned}\end{align} \]- x– the argument of the function
 - EXAMPLES: - sage: # needs sage.symbolic sage: from sage.functions.airy import airy_ai_general sage: x, n = var('x n') sage: airy_ai_general(-2, x) airy_ai(-2, x) sage: derivative(airy_ai_general(-2, x), x) airy_ai(-1, x) sage: airy_ai_general(n, x) airy_ai(n, x) sage: derivative(airy_ai_general(n, x), x) airy_ai(n + 1, x) - >>> from sage.all import * >>> # needs sage.symbolic >>> from sage.functions.airy import airy_ai_general >>> x, n = var('x n') >>> airy_ai_general(-Integer(2), x) airy_ai(-2, x) >>> derivative(airy_ai_general(-Integer(2), x), x) airy_ai(-1, x) >>> airy_ai_general(n, x) airy_ai(n, x) >>> derivative(airy_ai_general(n, x), x) airy_ai(n + 1, x) 
- class sage.functions.airy.FunctionAiryAiPrime[source]¶
- Bases: - BuiltinFunction- The derivative of the Airy Ai function; see - airy_ai()for the full documentation.- EXAMPLES: - sage: # needs sage.symbolic sage: x, n = var('x n') sage: airy_ai_prime(x) airy_ai_prime(x) sage: airy_ai_prime(0) -1/3*3^(2/3)/gamma(1/3) sage: airy_ai_prime(x)._sympy_() # needs sympy airyaiprime(x) - >>> from sage.all import * >>> # needs sage.symbolic >>> x, n = var('x n') >>> airy_ai_prime(x) airy_ai_prime(x) >>> airy_ai_prime(Integer(0)) -1/3*3^(2/3)/gamma(1/3) >>> airy_ai_prime(x)._sympy_() # needs sympy airyaiprime(x) 
- class sage.functions.airy.FunctionAiryAiSimple[source]¶
- Bases: - BuiltinFunction- The class for the Airy Ai function. - EXAMPLES: - sage: from sage.functions.airy import airy_ai_simple sage: f = airy_ai_simple(x); f # needs sage.symbolic airy_ai(x) sage: airy_ai_simple(x)._sympy_() # needs sage.symbolic airyai(x) - >>> from sage.all import * >>> from sage.functions.airy import airy_ai_simple >>> f = airy_ai_simple(x); f # needs sage.symbolic airy_ai(x) >>> airy_ai_simple(x)._sympy_() # needs sage.symbolic airyai(x) 
- class sage.functions.airy.FunctionAiryBiGeneral[source]¶
- Bases: - BuiltinFunction- The generalized derivative of the Airy Bi function. - INPUT: - alpha– return the \(\alpha\)-th order fractional derivative with respect to \(z\). For \(\alpha = n = 1,2,3,\ldots\) this gives the derivative \(\operatorname{Bi}^{(n)}(z)\), and for \(\alpha = -n = -1,-2,-3,\ldots\) this gives the \(n\)-fold iterated integral.
 \[ \begin{align}\begin{aligned}f_0(z) = \operatorname{Bi}(z)\\f_n(z) = \int_0^z f_{n-1}(t) dt\end{aligned}\end{align} \]- x– the argument of the function
 - EXAMPLES: - sage: # needs sage.symbolic sage: from sage.functions.airy import airy_bi_general sage: x, n = var('x n') sage: airy_bi_general(-2, x) airy_bi(-2, x) sage: derivative(airy_bi_general(-2, x), x) airy_bi(-1, x) sage: airy_bi_general(n, x) airy_bi(n, x) sage: derivative(airy_bi_general(n, x), x) airy_bi(n + 1, x) - >>> from sage.all import * >>> # needs sage.symbolic >>> from sage.functions.airy import airy_bi_general >>> x, n = var('x n') >>> airy_bi_general(-Integer(2), x) airy_bi(-2, x) >>> derivative(airy_bi_general(-Integer(2), x), x) airy_bi(-1, x) >>> airy_bi_general(n, x) airy_bi(n, x) >>> derivative(airy_bi_general(n, x), x) airy_bi(n + 1, x) 
- class sage.functions.airy.FunctionAiryBiPrime[source]¶
- Bases: - BuiltinFunction- The derivative of the Airy Bi function; see - airy_bi()for the full documentation.- EXAMPLES: - sage: # needs sage.symbolic sage: x, n = var('x n') sage: airy_bi_prime(x) airy_bi_prime(x) sage: airy_bi_prime(0) 3^(1/6)/gamma(1/3) sage: airy_bi_prime(x)._sympy_() # needs sympy airybiprime(x) - >>> from sage.all import * >>> # needs sage.symbolic >>> x, n = var('x n') >>> airy_bi_prime(x) airy_bi_prime(x) >>> airy_bi_prime(Integer(0)) 3^(1/6)/gamma(1/3) >>> airy_bi_prime(x)._sympy_() # needs sympy airybiprime(x) 
- class sage.functions.airy.FunctionAiryBiSimple[source]¶
- Bases: - BuiltinFunction- The class for the Airy Bi function. - EXAMPLES: - sage: from sage.functions.airy import airy_bi_simple sage: f = airy_bi_simple(x); f # needs sage.symbolic airy_bi(x) sage: f._sympy_() # needs sympy sage.symbolic airybi(x) - >>> from sage.all import * >>> from sage.functions.airy import airy_bi_simple >>> f = airy_bi_simple(x); f # needs sage.symbolic airy_bi(x) >>> f._sympy_() # needs sympy sage.symbolic airybi(x) 
- sage.functions.airy.airy_ai(alpha, x=None, hold_derivative=True, **kwds)[source]¶
- The Airy Ai function. - The Airy Ai function \(\operatorname{Ai}(x)\) is (along with \(\operatorname{Bi}(x)\)) one of the two linearly independent standard solutions to the Airy differential equation \(f''(x) - x f(x) = 0\). It is defined by the initial conditions: \[ \begin{align}\begin{aligned}\operatorname{Ai}(0)=\frac{1}{2^{2/3} \Gamma\left(\frac{2}{3}\right)},\\\operatorname{Ai}'(0)=-\frac{1}{2^{1/3}\Gamma\left(\frac{1}{3}\right)}.\end{aligned}\end{align} \]- Another way to define the Airy Ai function is: \[\operatorname{Ai}(x)=\frac{1}{\pi}\int_0^\infty \cos\left(\frac{1}{3}t^3+xt\right) dt.\]- INPUT: - alpha– return the \(\alpha\)-th order fractional derivative with respect to \(z\). For \(\alpha = n = 1,2,3,\ldots\) this gives the derivative \(\operatorname{Ai}^{(n)}(z)\), and for \(\alpha = -n = -1,-2,-3,\ldots\) this gives the \(n\)-fold iterated integral.
 \[ \begin{align}\begin{aligned}f_0(z) = \operatorname{Ai}(z)\\f_n(z) = \int_0^z f_{n-1}(t) dt\end{aligned}\end{align} \]- x– the argument of the function
- hold_derivative– whether or not to stop from returning higher derivatives in terms of \(\operatorname{Ai}(x)\) and \(\operatorname{Ai}'(x)\)
 - See also - EXAMPLES: - sage: n, x = var('n x') # needs sage.symbolic sage: airy_ai(x) # needs sage.symbolic airy_ai(x) - >>> from sage.all import * >>> n, x = var('n x') # needs sage.symbolic >>> airy_ai(x) # needs sage.symbolic airy_ai(x) - It can return derivatives or integrals: - sage: # needs sage.symbolic sage: airy_ai(2, x) airy_ai(2, x) sage: airy_ai(1, x, hold_derivative=False) airy_ai_prime(x) sage: airy_ai(2, x, hold_derivative=False) x*airy_ai(x) sage: airy_ai(-2, x, hold_derivative=False) airy_ai(-2, x) sage: airy_ai(n, x) airy_ai(n, x) - >>> from sage.all import * >>> # needs sage.symbolic >>> airy_ai(Integer(2), x) airy_ai(2, x) >>> airy_ai(Integer(1), x, hold_derivative=False) airy_ai_prime(x) >>> airy_ai(Integer(2), x, hold_derivative=False) x*airy_ai(x) >>> airy_ai(-Integer(2), x, hold_derivative=False) airy_ai(-2, x) >>> airy_ai(n, x) airy_ai(n, x) - It can be evaluated symbolically or numerically for real or complex values: - sage: airy_ai(0) # needs sage.symbolic 1/3*3^(1/3)/gamma(2/3) sage: airy_ai(0.0) # needs mpmath 0.355028053887817 sage: airy_ai(I) # needs sage.symbolic airy_ai(I) sage: airy_ai(1.0*I) # needs sage.symbolic 0.331493305432141 - 0.317449858968444*I - >>> from sage.all import * >>> airy_ai(Integer(0)) # needs sage.symbolic 1/3*3^(1/3)/gamma(2/3) >>> airy_ai(RealNumber('0.0')) # needs mpmath 0.355028053887817 >>> airy_ai(I) # needs sage.symbolic airy_ai(I) >>> airy_ai(RealNumber('1.0')*I) # needs sage.symbolic 0.331493305432141 - 0.317449858968444*I - The functions can be evaluated numerically either using mpmath. which can compute the values to arbitrary precision, and scipy: - sage: airy_ai(2).n(prec=100) # needs sage.symbolic 0.034924130423274379135322080792 sage: airy_ai(2).n(algorithm='mpmath', prec=100) # needs sage.symbolic 0.034924130423274379135322080792 sage: airy_ai(2).n(algorithm='scipy') # rel tol 1e-10 # needs scipy sage.symbolic 0.03492413042327323 - >>> from sage.all import * >>> airy_ai(Integer(2)).n(prec=Integer(100)) # needs sage.symbolic 0.034924130423274379135322080792 >>> airy_ai(Integer(2)).n(algorithm='mpmath', prec=Integer(100)) # needs sage.symbolic 0.034924130423274379135322080792 >>> airy_ai(Integer(2)).n(algorithm='scipy') # rel tol 1e-10 # needs scipy sage.symbolic 0.03492413042327323 - And the derivatives can be evaluated: - sage: airy_ai(1, 0) # needs sage.symbolic -1/3*3^(2/3)/gamma(1/3) sage: airy_ai(1, 0.0) # needs mpmath -0.258819403792807 - >>> from sage.all import * >>> airy_ai(Integer(1), Integer(0)) # needs sage.symbolic -1/3*3^(2/3)/gamma(1/3) >>> airy_ai(Integer(1), RealNumber('0.0')) # needs mpmath -0.258819403792807 - Plots: - sage: plot(airy_ai(x), (x, -10, 5)) + plot(airy_ai_prime(x), # needs sage.plot sage.symbolic ....: (x, -10, 5), color='red') Graphics object consisting of 2 graphics primitives - >>> from sage.all import * >>> plot(airy_ai(x), (x, -Integer(10), Integer(5))) + plot(airy_ai_prime(x), # needs sage.plot sage.symbolic ... (x, -Integer(10), Integer(5)), color='red') Graphics object consisting of 2 graphics primitives - REFERENCES: - Abramowitz, Milton; Stegun, Irene A., eds. (1965), “Chapter 10” 
 
- sage.functions.airy.airy_bi(alpha, x=None, hold_derivative=True, **kwds)[source]¶
- The Airy Bi function. - The Airy Bi function \(\operatorname{Bi}(x)\) is (along with \(\operatorname{Ai}(x)\)) one of the two linearly independent standard solutions to the Airy differential equation \(f''(x) - x f(x) = 0\). It is defined by the initial conditions: \[ \begin{align}\begin{aligned}\operatorname{Bi}(0)=\frac{1}{3^{1/6} \Gamma\left(\frac{2}{3}\right)},\\\operatorname{Bi}'(0)=\frac{3^{1/6}}{ \Gamma\left(\frac{1}{3}\right)}.\end{aligned}\end{align} \]- Another way to define the Airy Bi function is: \[\operatorname{Bi}(x)=\frac{1}{\pi}\int_0^\infty \left[ \exp\left( xt -\frac{t^3}{3} \right) +\sin\left(xt + \frac{1}{3}t^3\right) \right ] dt.\]- INPUT: - alpha– return the \(\alpha\)-th order fractional derivative with respect to \(z\). For \(\alpha = n = 1,2,3,\ldots\) this gives the derivative \(\operatorname{Bi}^{(n)}(z)\), and for \(\alpha = -n = -1,-2,-3,\ldots\) this gives the \(n\)-fold iterated integral.
 \[ \begin{align}\begin{aligned}f_0(z) = \operatorname{Bi}(z)\\f_n(z) = \int_0^z f_{n-1}(t) dt\end{aligned}\end{align} \]- x– the argument of the function
- hold_derivative– boolean (default:- True); whether or not to stop from returning higher derivatives in terms of \(\operatorname{Bi}(x)\) and \(\operatorname{Bi}'(x)\)
 - See also - EXAMPLES: - sage: n, x = var('n x') # needs sage.symbolic sage: airy_bi(x) # needs sage.symbolic airy_bi(x) - >>> from sage.all import * >>> n, x = var('n x') # needs sage.symbolic >>> airy_bi(x) # needs sage.symbolic airy_bi(x) - It can return derivatives or integrals: - sage: # needs sage.symbolic sage: airy_bi(2, x) airy_bi(2, x) sage: airy_bi(1, x, hold_derivative=False) airy_bi_prime(x) sage: airy_bi(2, x, hold_derivative=False) x*airy_bi(x) sage: airy_bi(-2, x, hold_derivative=False) airy_bi(-2, x) sage: airy_bi(n, x) airy_bi(n, x) - >>> from sage.all import * >>> # needs sage.symbolic >>> airy_bi(Integer(2), x) airy_bi(2, x) >>> airy_bi(Integer(1), x, hold_derivative=False) airy_bi_prime(x) >>> airy_bi(Integer(2), x, hold_derivative=False) x*airy_bi(x) >>> airy_bi(-Integer(2), x, hold_derivative=False) airy_bi(-2, x) >>> airy_bi(n, x) airy_bi(n, x) - It can be evaluated symbolically or numerically for real or complex values: - sage: airy_bi(0) # needs sage.symbolic 1/3*3^(5/6)/gamma(2/3) sage: airy_bi(0.0) # needs mpmath 0.614926627446001 sage: airy_bi(I) # needs sage.symbolic airy_bi(I) sage: airy_bi(1.0*I) # needs sage.symbolic 0.648858208330395 + 0.344958634768048*I - >>> from sage.all import * >>> airy_bi(Integer(0)) # needs sage.symbolic 1/3*3^(5/6)/gamma(2/3) >>> airy_bi(RealNumber('0.0')) # needs mpmath 0.614926627446001 >>> airy_bi(I) # needs sage.symbolic airy_bi(I) >>> airy_bi(RealNumber('1.0')*I) # needs sage.symbolic 0.648858208330395 + 0.344958634768048*I - The functions can be evaluated numerically using mpmath, which can compute the values to arbitrary precision, and scipy: - sage: airy_bi(2).n(prec=100) # needs sage.symbolic 3.2980949999782147102806044252 sage: airy_bi(2).n(algorithm='mpmath', prec=100) # needs sage.symbolic 3.2980949999782147102806044252 sage: airy_bi(2).n(algorithm='scipy') # rel tol 1e-10 # needs scipy sage.symbolic 3.2980949999782134 - >>> from sage.all import * >>> airy_bi(Integer(2)).n(prec=Integer(100)) # needs sage.symbolic 3.2980949999782147102806044252 >>> airy_bi(Integer(2)).n(algorithm='mpmath', prec=Integer(100)) # needs sage.symbolic 3.2980949999782147102806044252 >>> airy_bi(Integer(2)).n(algorithm='scipy') # rel tol 1e-10 # needs scipy sage.symbolic 3.2980949999782134 - And the derivatives can be evaluated: - sage: airy_bi(1, 0) # needs sage.symbolic 3^(1/6)/gamma(1/3) sage: airy_bi(1, 0.0) # needs mpmath 0.448288357353826 - >>> from sage.all import * >>> airy_bi(Integer(1), Integer(0)) # needs sage.symbolic 3^(1/6)/gamma(1/3) >>> airy_bi(Integer(1), RealNumber('0.0')) # needs mpmath 0.448288357353826 - Plots: - sage: plot(airy_bi(x), (x, -10, 5)) + plot(airy_bi_prime(x), # needs sage.plot sage.symbolic ....: (x, -10, 5), color='red') Graphics object consisting of 2 graphics primitives - >>> from sage.all import * >>> plot(airy_bi(x), (x, -Integer(10), Integer(5))) + plot(airy_bi_prime(x), # needs sage.plot sage.symbolic ... (x, -Integer(10), Integer(5)), color='red') Graphics object consisting of 2 graphics primitives - REFERENCES: - Abramowitz, Milton; Stegun, Irene A., eds. (1965), “Chapter 10”