Dear R users, I'm porting a piece of Matlab code to R, but I'm now stuck with the following: I need an equivalent of besselJ(x, nu) that can handle a complex argument x. I couldn't find any R implementation. I did find a possible fortran solution in SLATEC (< http://www.netlib.org/slatec/ > , CBESJ-C), however I've never tried to use external C or Fortran code together with my R code, so I'm not sure where to go for a simple solution. Any advice welcome, Best regards baptiste _____________________________ Baptiste Augui? Physics Department University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag http://projects.ex.ac.uk/atto
Hello Baptiste Bessel functions with complex arguments are not supported in R. Neither matlab nor the Gnu Scientific Library support them either. . . . but . . . the pari/gp system (released on the GPL) does: ? besselj(1+I,3) %3 = 0.6919067491368555819808728680 + 0.4484268613977010268818252591*I ? You can access some pari/gp functionality from within R by using the elliptic package, although unfortunately its wrapper function, P.pari(), is not quite flexible enough to deal with besselj(). I'd be happy to discuss this offline; P.pari() will need only minor changes to accommodate besselj(). HTH Robin On 9 Mar 2008, at 13:44, baptiste Augui? wrote:> Dear R users, > > > I'm porting a piece of Matlab code to R, but I'm now stuck with the > following: I need an equivalent of besselJ(x, nu) that can handle a > complex argument x. I couldn't find any R implementation. I did find > a possible fortran solution in SLATEC (< http://www.netlib.org/slatec/ >> , CBESJ-C), however I've never tried to use external C or Fortran > code together with my R code, so I'm not sure where to go for a > simple solution. > > Any advice welcome, > > Best regards > > baptiste > > _____________________________ > > Baptiste Augui? > > Physics Department > University of Exeter > Stocker Road, > Exeter, Devon, > EX4 4QL, UK > > Phone: +44 1392 264187 > > http://newton.ex.ac.uk/research/emag > http://projects.ex.ac.uk/atto > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Robin Hankin Uncertainty Analyst and Neutral Theorist, National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743
{Diverted from an R-help thread}>>>>> "Robin" == Robin Hankin <r.hankin at noc.soton.ac.uk> >>>>> on Mon, 10 Mar 2008 08:49:06 +0000 writes: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