Re: [R] besselK

From: Ben Bolker <>
Date: Thu, 14 Jun 2007 13:21:51 +0000 (UTC)

Robin Hankin <r.hankin <at>> writes:

> Hello
> AFAIK, R has no capability for evaluating Bessel functions for
> complex arguments.
> Bessel functions for complex arguments are difficult to evaluate
> numerically.
> Some Bessel functions require cut lines or consideration of Riemann
> surfaces.
> The GSL library (for which the gsl package is an R wrapper) does
> not include such functionality although the issue has arisen
> on the GSL email list a couple of times over the last few years.
> Writing R functionality for Bessel functions (and in particular
> the Airy function) is on my List of Things To Do, but
> don't hold your breath . . .
> best wishes
> Robin
> On 14 Jun 2007, at 10:31, ivivi mwaniki wrote:
> > Assistance,
> > besselK- complex number problem
> > Im a student intrested in using R in my learning and research
> > work in option pricing however i have a problem with besselK
> > function In R.
> > Would you assit me in computing the besselK of third kind of a
> > complex number in R.
> > Any code or suggestion will be highly appriceiated
> > eg
> > besselK(2,10) works well.. but
> > besselK(2,10i) doesnt work !!
> >
> > im supprised it works in MATLAB but NOT in R.
> > rgds
> > ivivi mwaniki
> > student kenya
> >
> >

   I have some code for complex Bessel functions which consists of R wrappers for C++ code: the licensing a little obscure -- the code is ultimately from "Computation of Special Functions", Zhang and Jin, John Wiley and Sons, 1996. The FORTRAN routines are available from ; Chris Bond has made a C++ translation available. Both versions are copyrighted: Zhang and Jin say "we give permission to the user who downloads these routines to incorporate any of these routines into his or her programs provided that the copyright is acknowledged". The code seems to work for my purposes, but hasn't been thoroughly tested.

  I can send my crude versions to anyone who would like it. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 14 Jun 2007 - 14:03:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Jun 2007 - 14:32:02 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.