Airy {Bessel} | R Documentation |
Airy Functions (and Their First Derivative)
Description
Compute the Airy functions or
or their first
derivatives,
and
.
The Airy functions are solutions of the differential equation
for , and are related to each other and to the
(modified) Bessel functions via (many identities, see
https://dlmf.nist.gov/9.6), e.g., if
,
and
Usage
AiryA(z, deriv = 0, expon.scaled = FALSE, verbose = 0)
AiryB(z, deriv = 0, expon.scaled = FALSE, verbose = 0)
Arguments
z |
complex or numeric vector. |
deriv |
order of derivative; must be 0 or 1. |
expon.scaled |
logical indicating if the result should be scaled by an exponential factor (typically to avoid under- or over-flow). |
verbose |
integer defaulting to 0, indicating the level of verbosity notably from C code. |
Details
By default, when expon.scaled
is false, AiryA()
computes the complex Airy function or its derivative
on
deriv=0
or deriv=1
respectively.
When expon.scaled
is true, it returns
or
,
effectively removing the exponential decay in
and
the exponential growth in
,
where
, and
Arg(z)
.
While the Airy functions and
are
analytic in the whole
plane, the corresponding scaled
functions (for
expon.scaled=TRUE
) have a cut along the
negative real axis.
By default, when expon.scaled
is false, AiryB()
computes the complex Airy function or its derivative
on
deriv=0
or deriv=1
respectively.
When expon.scaled
is true, it returns
or
,
to remove the exponential behavior in both the left and right half
planes where, as above,
.
Value
a complex or numeric vector of the same length (and class) as z
.
Author(s)
Donald E. Amos, Sandia National Laboratories, wrote the original fortran code. Martin Maechler did the R interface.
References
see BesselJ
; notably for many results the
Digital Library of Mathematical Functions (DLMF), Chapter 9 Airy and Related Functions at https://dlmf.nist.gov/9.
See Also
BesselI
etc; the Hankel functions Hankel
.
The CRAN package Rmpfr has Ai(x)
for
arbitrary precise "mpfr"-numbers x
.
Examples
## The AiryA() := Ai() function -------------
curve(AiryA, -20, 100, n=1001)
curve(AiryA, -1, 100, n=1011, log="y") -> Aix
curve(AiryA(x, expon.scaled=TRUE), -1, 50, n=1001)
## Numerically "proving" the 1st identity above :
z <- Aix$x; i <- z > 0; head(z <- z[i <- z > 0])
Aix <- Aix$y[i]; zeta <- 2/3*z*sqrt(z)
stopifnot(all.equal(Aix, 1/pi * sqrt(z/3)* BesselK(zeta, nu = 1/3),
tol = 4e-15)) # 64b Lnx: 7.9e-16; 32b Win: 1.8e-15
## This gives many warnings (248 on nb-mm4, F24) about lost accuracy, but on Windows takes ~ 4 sec:
curve(AiryA(x, expon.scaled=TRUE), 1, 10000, n=1001, log="xy")
## The AiryB() := Bi() function -------------
curve(AiryB, -20, 2, n=1001); abline(h=0,v=0, col="gray",lty=2)
curve(AiryB, -1, 20, n=1001, log = "y") # exponential growth (x > 0)
curve(AiryB(x,expon.scaled=TRUE), -1, 20, n=1001)
curve(AiryB(x,expon.scaled=TRUE), 1, 10000, n=1001, log="x")