Skip to content

Re Bessel functions of complex argument

3 messages · Martin Maechler, Brian Ripley, robin hankin

#
{Diverted from an R-help thread}
Robin> Hello Baptiste Bessel functions with complex
    Robin> arguments are not supported in R.

    Robin> Neither matlab nor the Gnu Scientific Library support
    Robin> them either.

    Robin> . . . but . . .

    Robin> the pari/gp system (released on the GPL) does:

    Robin> ? besselj(1+I,3)
    Robin> %3 = 0.6919067491368555819808728680 + 0.4484268613977010268818252591*I
    Robin> ?


    Robin> You can access some pari/gp functionality from within R
    Robin> by using the elliptic package, although unfortunately
    Robin> its wrapper function, P.pari(),  is not quite flexible enough
    Robin> to deal with besselj().

    Robin> I'd be happy to discuss this offline; P.pari() will need only
    Robin> minor changes to accommodate besselj().

Hi Robin,
have you looked at *how* pari/gp does this?
If they have a C routine, it might be worth considering to add
``the'' complex Bessel functionality to R.

We have seen several occasions where people had a clear usage
need for them.

{{I have a vague d?j?-vue feeling on this whole topic ....}}

Martin Maechler, ETH Zurich
#
On Mon, 10 Mar 2008, Martin Maechler wrote:

            
To an R package, surely?  They hardly seem important enough for base R.

There are C implementations in several places, e.g. ACM algorithm 644 
(also netlib.org/amos).

  
    
#
On 10 Mar 2008, at 11:03, Prof Brian Ripley wrote:

            
Thanks for this.  I'll have a look at netlib.  Perhaps a wrapper for  
netlib,
  along the lines of  the gsl package, would be possible.  I also need
the gamma function with complex  arguments and I suspect
that this is included.

PARI/GP  is a large multi-developer effort, and provides an
environment not unlike R but geared towards pure mathematics rather
than statistics.  It includes arbitrary-precision arithmetic and many
pure maths constructs such as number theory and p-adic metrics.

(I must confess to being not terribly familiar with the
Bessel suite; I only  really know about PARI/GP's  elliptic  
functions).  There
is no easy way to access the  code  for any specific functionality
in isolation, AFAICS.

One of my "longer-term" plans is to write a package that includes
a wrapper for GP (PARI is the front end, a command line wrapper) but
this is not entirely straightforward. Implementing a useful wrapper  
proved
to be rather tricky.  I expected that  the methodology would
approximate the gsl package but this was not the case:
many of the features of PARI/GP are alien to the precepts and
tenets of R.   My attempts stalled a couple of years ago after
I finished the elliptic package which included a fit-for-purpose, but
very very basic, wrapper for two or three functions.

Notwithstanding this, I think that an R wrapper for PARI/GP would
be very desirable.   Comments anyone?





--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743