Bessel {Bessel} R Documentation

## Bessel Functions of Complex Arguments I(), J(), K(), and Y()

### Description

Compute the Bessel functions I(), J(), K(), and Y(), of complex arguments z and real nu,

### Usage

BesselI(z, nu, expon.scaled = FALSE, nSeq = 1, verbose = 0)
BesselJ(z, nu, expon.scaled = FALSE, nSeq = 1, verbose = 0)
BesselK(z, nu, expon.scaled = FALSE, nSeq = 1, verbose = 0)
BesselY(z, nu, expon.scaled = FALSE, nSeq = 1, verbose = 0)


### Arguments

 z complex or numeric vector. nu numeric (scalar). expon.scaled logical indicating if the result should be scaled by an exponential factor, typically to avoid under- or over-flow. See the ‘Details’ about the specific scaling. nSeq positive integer; if > 1, computes the result for a whole sequence of nu values; if nu >= 0,nu, nu+1, ..., nu+nSeq-1, if nu < 0, nu, nu-1, ..., nu-nSeq+1. verbose integer defaulting to 0, indicating the level of verbosity notably from C code.

### Details

The case nu < 0 is handled by using simple formula from Abramowitz and Stegun, see details in besselI().

The scaling activated by expon.scaled = TRUE depends on the function and the scaled versions are

J():

BesselJ(z, nu, expo=TRUE):= \exp(-\left|\Im(z)\right|) J_{\nu}(z)

Y():

BesselY(z, nu, expo=TRUE) := \exp(-\left|\Im(z)\right|) Y_{\nu}(z)

I():

BesselI(z, nu, expo=TRUE) := \exp(-\left|\Re(z)\right|) I_{\nu}(z)

K():

BesselK(z, nu, expo=TRUE) := \exp(z) K_{\nu}(z)

### Value

a complex or numeric vector (or matrix with nSeq columns if nSeq > 1) of the same length (or nrow when nSeq > 1) and mode as z.

### Author(s)

Donald E. Amos, Sandia National Laboratories, wrote the original fortran code. Martin Maechler did the translation to C, and partial cleanup (replacing goto's), in addition to the R interface.

### References

Abramowitz, M., and Stegun, I. A. (1955, etc). Handbook of mathematical functions (NBS AMS series 55, U.S. Dept. of Commerce), http://people.math.sfu.ca/~cbm/aands/

Wikipedia (20nn). Bessel Function, https://en.wikipedia.org/wiki/Bessel_function

D. E. Amos (1986) Algorithm 644: A portable package for Bessel functions of a complex argument and nonnegative order; ACM Trans. Math. Software 12, 3, 265–273.

D. E. Amos (1983) Computation of Bessel Functions of Complex Argument; Sand83-0083.

D. E. Amos (1983) Computation of Bessel Functions of Complex Argument and Large Order; Sand83-0643.

D. E. Amos (1985) A subroutine package for Bessel functions of a complex argument and nonnegative order; Sand85-1018.

Olver, F.W.J. (1974). Asymptotics and Special Functions; Academic Press, N.Y., p.420

The base R functions besselI(), besselK(), etc.

The Hankel functions (of first and second kind), H_{\nu}^{(1)}(z) and H_{\nu}^{(2)}(z): Hankel.

The Airy functions Ai() and Bi() and their first derivatives, Airy.

For large x and/or nu arguments, algorithm AS~644 is not good enough, and the results may overflow to Inf or underflow to zero, such that direct computation of \log(I_\nu(x)) and \log(K_\nu(x)) are desirable. For this, we provide besselI.nuAsym(), besselIasym() and besselK.nuAsym(*, log= *), based on asymptotic expansions.

### Examples


## For real small arguments, BesselI() gives the same as base::besselI() :
set.seed(47); x <- sort(round(rlnorm(20), 2))
M <- cbind(x, b = besselI(x, 3), B = BesselI(x, 3))
stopifnot(all.equal(M[,"b"], M[,"B"], tol = 2e-15)) # ~4e-16 even
M

## and this is true also for the 'exponentially scaled' version:
Mx <- cbind(x, b = besselI(x, 3, expon.scaled=TRUE),
B = BesselI(x, 3, expon.scaled=TRUE))
stopifnot(all.equal(Mx[,"b"], Mx[,"B"], tol = 2e-15)) # ~4e-16 even


[Package Bessel version 0.6-0 Index]