Package Bessel. February 19, 2015

Similar documents
NAG Library Function Document nag_complex_bessel_y (s17dcc)

Numerical Aspects of Special Functions

NAG Library Function Document nag_complex_bessel_j (s17dec)

2012/05/29 DRAFT WG5/N1921

NAG Library Function Document nag_complex_bessel_i (s18dec)

Package Combine. R topics documented: September 4, Type Package Title Game-Theoretic Probability Combination Version 1.

General Terms: Algorithms, exponential integral function, multiple precision

Package subplex. April 5, 2018

Package crochet. January 8, 2018

Chapter 1 Introduction to MATLAB

Module 3.5: nag fresnel intg Fresnel Integrals. Contents

Package CLA. February 6, 2018

Package exporkit. R topics documented: May 5, Type Package Title Expokit in R Version Date

Package CompGLM. April 29, 2018

Efficient implementation of elementary functions in the medium-precision range

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff

1 of 21 8/6/2018, 8:17 AM

Package marqlevalg. February 20, 2015

Section 4.3. Graphing Exponential Functions

Package orthogonalsplinebasis

STATISTICS 579 R Tutorial : Programming in R

Review Questions 26 CHAPTER 1. SCIENTIFIC COMPUTING

Package adaptivetau. October 25, 2016

Package dkdna. June 1, Description Compute diffusion kernels on DNA polymorphisms, including SNP and bi-allelic genotypes.

Curriculum Map: Mathematics

Package appell. February 19, 2015

Chapter 4: Basic C Operators

Package qboxplot. November 12, qboxplot... 1 qboxplot.stats Index 5. Quantile-Based Boxplots

Package slam. February 15, 2013

Package RYoudaoTranslate

Package spark. July 21, 2017

Package RCA. R topics documented: February 29, 2016

The partitions Package

Package gpdtest. February 19, 2015

Voluntary State Curriculum Algebra II

Lecture Objectives. Structured Programming & an Introduction to Error. Review the basic good habits of programming

Organizing and Debugging Matlab Programs

Package ECctmc. May 1, 2018

b) develop mathematical thinking and problem solving ability.

Math 104, Spring 2010 Course Log

CHAPTER 5: Exponential and Logarithmic Functions

6.6 Modified Bessel Functions of Integer Order

Package quadprogxt. February 4, 2018

Package spatialtaildep

Introduction to Engineering gii

Package CryptRndTest

Package Brobdingnag. R topics documented: March 19, 2018

Omit Present Value on pages ; Example 7.

Package simmsm. March 3, 2015

A-SSE.1.1, A-SSE.1.2-

Package sfc. August 29, 2016

Package mpmi. November 20, 2016

Package svd. R topics documented: March 24, Type Package. Title Interfaces to various state-of-art SVD and eigensolvers. Version 0.3.

Package hbm. February 20, 2015

Package smoothmest. February 20, 2015

Package bigalgebra. R topics documented: February 19, 2015

Package robustreg. R topics documented: April 27, Version Date Title Robust Regression Functions

Package PBSddesolve. September 20, 2016

MAT128A: Numerical Analysis Lecture One: Course Logistics and What is Numerical Analysis?

Package arulesnbminer

Package Deriv. November 22, 2017

A Proposal to Add Mathematical Special Functions to the C++ Standard Library (version 2)

Package clustering.sc.dp

Package CatEncoders. March 8, 2017

Package SAENET. June 4, 2015

Package svd. R topics documented: September 26, 2017

Package HI. February 19, 2015

Core Mathematics 1 Transformations of Graphs

The nor1mix Package. June 12, 2007

Additional Key Words and Phrases: Accuracy, elementary function evaluation, floating point, Fortran, mathematical library, portable software

Package UnivRNG. R topics documented: January 10, Type Package

Package frt. R topics documented: February 19, 2015

Package coga. May 8, 2018

Package GenSA. R topics documented: January 17, Type Package Title Generalized Simulated Annealing Version 1.1.

Basic stuff -- assignments, arithmetic and functions

16.69 TAYLOR: Manipulation of Taylor series

Package Rglpk. May 18, 2017

Package reval. May 26, 2015

Prerequisites: Completed Algebra 1 and Geometry and passed Algebra 2 with a C or better

Package coxsei. February 24, 2015

Package waterfall. R topics documented: February 15, Type Package. Version Date Title Waterfall Charts in R

Package assortnet. January 18, 2016

Package Calculator.LR.FNs

Package beanplot. R topics documented: February 19, Type Package

correlated to the Michigan High School Mathematics Content Expectations

Package rgcvpack. February 20, Index 6. Fitting Thin Plate Smoothing Spline. Fit thin plate splines of any order with user specified knots

DOWNLOAD PDF BIG IDEAS MATH VERTICAL SHRINK OF A PARABOLA

Package Iso. June 1, Index 8. Bivariate isotonic regression.

Package gibbs.met. February 19, 2015

Data Types and Basic Calculation

Package rocc. February 20, 2015

Package flsa. February 19, 2015

The nor1mix Package. August 3, 2006

Package NetCluster. R topics documented: February 19, Type Package Version 0.2 Date Title Clustering for networks

Introduction to Complex Analysis

Package sciplot. February 15, 2013

Continued Fractions for Special Functions: Handbook and Software

Objectives and Homework List

Package hypergeo. R topics documented: April 7, 2016

Package tmpm. February 29, 2016

Transcription:

Version 0.5-5 Date 2013-12-10 Package Bessel February 19, 2015 Title Bessel -- Bessel Functions Computations and Approximations Author Martin Maechler Maintainer Martin Maechler <maechler@stat.math.ethz.ch> Depends Rmpfr Suggests gsl Bessel Function Computations for complex and real numbers; notably interfacing TOMS 644; approximations for large arguments, experiments, etc. License GPL (>= 2) URL http://specfun.r-forge.r-project.org/ NeedsCompilation yes Repository CRAN Date/Publication 2013-12-10 10:36:57 R topics documented: Airy............................................. 2 Bessel............................................ 3 BesselH........................................... 4 besseli.nuasym....................................... 6 besseliasym......................................... 7 bi.............................................. 9 Index 10 1

2 Airy Airy Airy Functions (and Their First Derivative) Compute the Airy functions Ai or Bi or their first derivatives, d dz Ai(z) and d dz Bi(z). AiryA(z, deriv = 0, expon.scaled = FALSE) AiryB(z, deriv = 0, expon.scaled = FALSE) z Details 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). By default, when expon.scaled is false, AiryA() computes the complex Airy function Ai(z) or its derivative d dz Ai(z) on deriv=0 or deriv=1 respectively. When expon.scaled is true, it returns exp(ζ)ai(z) or exp(ζ) d dz Ai(z), effectively removing the exponential decay in π/3 < arg(z) < π/3 and the exponential growth in π/3 < arg(z) < π, where ζ = 2 3 z z. While the Airy functions Ai(z) and d/dzai(z) are analytic in the whole z 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 Bi(z) or its derivative d dz Bi(z) on deriv=0 or deriv=1 respectively. When expon.scaled is true, it returns exp( R(ζ) )Bi(z) or exp( R(ζ) ) d dz Bi(z), to remove the exponential behavior in both the left and right half planes where, as above, ζ = 2 3 z z. a complex or numeric vector of the same length (and class) as z. Donald E. Amos, Sandia National Laboratories, wrote the original fortran code. Martin Maechler did the R interface. see BesselI.

Bessel 3 BesselI etc; the Hankel functions Hankel. ## The AiryA() := Ai() function curve(airya, -20, 100, n=1001) curve(airya, -1, 100, n=1001, log="y") curve(airya(x, expon.scaled=true), -1, 50, n=1001) 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") Bessel Bessel Functions of Complex I(), J(), K(), and Y() Compute the Bessel functions I(), J(), K(), and Y(), of complex arguments z and real nu, BesselI(z, nu, expon.scaled = FALSE, nseq = 1) BesselJ(z, nu, expon.scaled = FALSE, nseq = 1) BesselK(z, nu, expon.scaled = FALSE, nseq = 1) BesselY(z, nu, expon.scaled = FALSE, nseq = 1) z nu expon.scaled nseq complex or numeric vector. numeric (scalar). logical indicating if the result should be scaled by an exponential factor (typically to avoid under- or over-flow). 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. Details The case nu < 0 is handled by using simple formula from Abramowitz and Stegun.

4 BesselH 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. Donald E. Amos, Sandia National Laboratories, wrote the original fortran code. Martin Maechler did the R interface. Abramowitz, M., and Stegun, I. A. (1955, etc). Handbook of mathematical functions (NBS AMS series 55, U.S. Dept. of Commerce). D. E. Amos (1986) 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, etc. ## 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"])) M BesselH Hankel (H-Bessel) Function (of Complex Argument) Compute the Hankel functions H(1, ) and H(2, ), also called H-Bessel function (of the third kind), of complex arguments. BesselH(m, z, nu, expon.scaled = FALSE, nseq = 1)

BesselH 5 m integer, either 1 or 2, indicating the kind of Hankel function. z complex or numeric vector of valus different from 0. nu Details expon.scaled numeric, must currently be non-negative. logical indicating if the result should be scaled by an exponential factor (typically to avoid under- or over-flow). nseq positive integer,... By default (when expon.scaled is false), the resulting sequence (of length nseq) is computed for j = 1,..., nseq. If expon.scaled is true, the sequence is y j = H(m, ν + j 1, z), y j = exp( mzi) H(m, ν + j 1, z), where m = 3 2m (and i 2 = 1), for j = 1,..., nseq. a complex or numeric vector (or matrix if nseq > 1) of the same length and mode as z. Donald E. Amos, Sandia National Laboratories, wrote the original fortran code. Martin Maechler did the R interface. see BesselI. BesselI etc; the Airy function Airy. ##------------------ H(1, *) ---------------- nus <- c(1,2,5,10) for(i in seq_along(nus)) curve(besselh(1, x, nu=nus[i]), -10, 10, add= i > 1, col=i, n=1000) legend("topleft", paste("nu = ", format(nus)), col = seq_along(nus), lty=1) ## nu = 10 looks a bit "special"... hmm... curve(besselh(1, x, nu=10), -.3,.3, col=4, ylim = c(-10,10), n=1000)

6 besseli.nuasym ##------------------ H(2, *) ---------------- for(i in seq_along(nus)) curve(besselh(2, x, nu=nus[i]), -10, 10, add= i > 1, col=i, n=1000) legend("bottomright", paste("nu = ", format(nus)), col = seq_along(nus), lty=1) ## the same nu = 10 behavior.. besseli.nuasym Asymptotic Expansion of Bessel I(x,nu) and K(x,nu) for Large nu (and x) Compute Bessel functions I ν (x) and K ν (x) for large ν and possibly large x, using asymptotic expansions in Debye polynomials. besseli.nuasym(x, nu, k.max, expon.scaled = FALSE, log = FALSE) besselk.nuasym(x, nu, k.max, expon.scaled = FALSE, log = FALSE) x numeric, 0. nu k.max expon.scaled numeric; The order (maybe fractional!) of the corresponding Bessel function. integer number of terms in the expansion. Must be in 0:4, currently. logical; if TRUE, the results are exponentially scaled in order to avoid overflow (I ν ) or underflow (K ν ), respectively. log logical; if TRUE, log(f(.)) is returned instead of f. Details Abramowitz & Stegun, page 378, has formula 9.7.7 and 9.7.8 for the asymptotic expansions of I ν (x) and K ν (x), respectively. The Debye polynomials u k (x) are defined in 9.3.9 and 9.3.10 (page 366). a numeric vector of the same length as the long of x and nu. (usual argument recycling is applied implicitly.) Martin Maechler

besseliasym 7 Abramowitz, M., and Stegun, I. A. (1955, etc). Handbook of mathematical functions (NBS AMS series 55, U.S. Dept. of Commerce). From this package Bessel BesselI(); further, besseliasym() for the case when x is large and ν is small or moderate; further base besseli, etc x <- c(1:10, 20, 50, 100, 100000) nu <- c(1, 10, 20, 50, 10^(2:10)) sapply(0:4, function(k.) sapply(nu, function(n.) besseli.nuasym(x, nu=n., k.max = k., log = TRUE))) sapply(0:4, function(k.) sapply(nu, function(n.) besselk.nuasym(x, nu=n., k.max = k., log = TRUE))) besseliasym Asymptotic Expansion of besseli(x,nu) For Large x Compute Bessel function I ν (x) and K ν (x) for large x and small or moderate ν, using the asymptotic expansion (9.7.1), p.377 of Abramowitz & Stegun, for x, even valid for complex x, I a (x) = exp(x)/ 2πx f(x, a), where f(x, a) = 1 µ 1 8x + (µ 1)(µ 9) 2!(8x) 2..., and µ = 4a 2 and arg(x) < π/2. Whereas besseliasym(x,a) computes I a (x), besseli.ftrms returns the corresponding terms in the series expansion of f(x, a) above. besseliasym (x, nu, k.max = 10, expon.scaled = FALSE, log = FALSE) besseli.ftrms(x, nu, K = 20)

8 besseliasym x numeric, 0. nu k.max, K expon.scaled numeric; The order (maybe fractional!) of the corresponding Bessel function. integer number of terms in the expansion. logical; if TRUE, the results are exponentially scaled in order to avoid overflow. log logical; if TRUE, log(f(.)) is returned instead of f. Details... FIXME... a numeric vector of the same length as x. Martin Maechler Abramowitz, M., and Stegun, I. A. (1955, etc). Handbook of mathematical functions (NBS AMS series 55, U.S. Dept. of Commerce). From this package Bessel() BesselI(); further, besseli.nuasym() which is useful when ν is large (as well); further base besseli, etc x <- c(1:10, 20, 50, 100^(2:10)) nu <- c(1, 10, 20, 50, 100) r <- lapply(c(0:4,10,20), function(k.) sapply(nu, function(n.) besseliasym(x, nu=n., k.max = k., log = TRUE))) warnings()

bi 9 bi Bessel I() function Simple Series Representation Computes the modified Bessel I function, using one of its basic definitions as an infinite series. The implementation is pure R, working for numeric, complex, but also e.g., for objects of class "mpfr" from package Rmpfr. bi(x, nu, nterm = 800, expon.scaled = FALSE, log = FALSE, Ceps = if (isnum) 8e-16 else 2^(-x@.Data[[1]]@prec)) x numeric of complex vector, or of another class for which arithmetic methods are defined, notably objects of class mpfr. nu non-negative numeric (scalar). nterm integer indicating the number of terms to be used. should be in the order of abs(x), but can be smaller for large x. A warning is given, when nterm was chosen too small. expon.scaled logical indicating if the result should be scaled by exp( abs(x)). log logical indicating if the logarithm logi.() is required. is not yet implemented! Ceps a relative error tolerance for checking if nterm has been sufficient. The default is correct for double precision and also for multiprecision objects. a numeric (or complex or...) vector of the same class and length as x. Martin Maechler Abramowitz, M., and Stegun, I. A. (1955, etc). Handbook of mathematical functions (NBS AMS series 55, U.S. Dept. of Commerce). This package BesselI, base besseli, etc stopifnot(all.equal(bi (1:10, 1), # R code besseli(1:10, 1)))# internal C code w/ different algorithm

Index Topic math Airy, 2 Bessel, 3 BesselH, 4 besseli.nuasym, 6 besseliasym, 7 bi, 9 Airy, 2, 5 AiryA (Airy), 2 AiryB (Airy), 2 Bessel, 3 BesselH, 4 BesselI, 2, 3, 5, 7 9 BesselI (Bessel), 3 besseli, 4, 7 9 besseli.ftrms (besseliasym), 7 besseli.nuasym, 6, 8 besseliasym, 7, 7 BesselJ (Bessel), 3 BesselK (Bessel), 3 besselk.nuasym (besseli.nuasym), 6 BesselY (Bessel), 3 bi, 9 class, 9 complex, 7, 9 Hankel, 3 Hankel (BesselH), 4 matrix, 4, 5 mode, 4, 5 mpfr, 9 nrow, 4 numeric, 9 10