Using Bessel function in ROOT (posted for Sam Gregson)

Dear ROOT experts,

I wondered if I could ask you a quick question…

I am using ROOT 6.06/02 and trying to use a bessel function:

double skellam(double k, double mu1, double mu2) {
return std::exp(-(mu1+mu2))std::pow(mu1/mu2,0.5k) *
ROOT::Math::cyl_bessel_i(std::abs(k), 2.0 * std::sqrt(mu1*mu2));

However, when I compile my script in ROOT I see:

/home/sam/C_Code/Peck_Problem/./PeckMacro.C:151:70: error: no member named
’cyl_bessel_i’ in namespace 'ROOT::Math’
return std::exp(-(mu1+mu2))std::pow(mu1/mu2,0.5k) * ROOT::Math::cyl_b…

I did the following checks:

  1. Checked mathmore was enabled - yes returned
  2. Added #include
    "/home/sam/ROOT/root-6.06.02/math/mathmore/src/SpecFuncMathMore.cxx" to my
    script, but now I see:

In file included from /home/sam/C_Code/Peck_Problem/./PeckMacro.C:4:
fatal error:
‘gsl/gsl_sf_bessel.h’ file not found
#include “gsl/gsl_sf_bessel.h”

I’m not sure what this means and don’t want to break any of the files.

Could you advise me please?



I am now sign up - thanks Hamish! I’d appreciate any help, I’m sure I just need to link something else up.

[code]#include “Math/SpecFunc.h”

double skellam(double k, double mu1, double mu2) {
return std::exp(-(mu1 + mu2)) * std::pow(mu1 / mu2, 0.5 * k) *
ROOT::Math::cyl_bessel_i(std::abs(k), 2.0 * std::sqrt(mu1 * mu2));

root [0] gSystem->Load("libMathMore"); root [1] .L PeckMacro.C root [2] skellam(1, 2, 3)

That got it! Thank you very much, Pepe :slight_smile: