Bessel Function


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.26.06
Platform: Not Provided
Compiler: Ubuntu


Hello experts from root, I am having quite a hard time trying to run a code in which I need to use the irregular modified cilyndrical Bessel function for the zeroth and first order. I have tried by first defining it as ROOT’s website proposes for special math functions:

[code] #include “Math/SpecFunc.h”
#include
#ifndef PI
#define PI 3.14159265358979323846264338328 /* pi */
#endif
#include “gsl/gsl_sf_bessel.h”
#include
#include <TMath.h>
#include <TSystem.h>
// #include <RooUnfold.h>
Double_t pi=3.14159265358979323846;
Double_t tau=35.92;
Double_t alfa=1/137;
Double_t q0=1;
Double_t mf = 0;
Double_t ef = 10/9;

double cyl_bessel_k(double nu, double x) {

return gsl_sf_bessel_Knu(nu, x);

}

double func2(double* q, double* x, double z, double r, double* p) {
double qq = q[0];
double xx = x[0];
// double a = p[0];
// double b = p[1];
// double c = p[2];
double x1 = (xx/p[1]);
double x2 = (p[1]/xx);
double z1 = (1.0-z);
double epsilon2 = zz1qq + pow(mf,2);
double epsilon = sqrt(epsilon2);
// double cyl_bessel_k(double epsilon, double r) = gsl_sf_bessel_Knu(0, epsilonr);
// double cyl_bessel_k(double epsilon, double r) = gsl_sf_bessel_Knu(1, epsilon
r);
double psiT2 = (6alfa)/(4pow(pi,2))ef((pow(z,2) + pow(z1,2))epsilon2(cyl_bessel_Knu(1,epsilonr)) + pow(mf,2)(cyl_bessel_Knu(0,epsilonr)));
double psiL2 = (6
alfa)/(4pow(pi,2))ef(4qqpow(z,2)pow(z1,2)(cyl_bessel_Knu(0,epsilonr)));
// double psiTL2 = psiT2 + psiL2;

return psiT2;

}[/code]

So I need it to give the results for the zeroth and first order while depending on the previous epsilon*r. When I compile it the following error shows: /home/rona/fit2Histo.C:11:10: fatal error: ‘gsl/gsl_sf_bessel.h’ file not found
#include “gsl/gsl_sf_bessel.h”

Feel free to correct me please,
I would really appreciate it if you take the time to solve my problem.
Thanks!

Dear Jorge,

Welcome to the ROOT community!
I would like to remind, first of all, the tips for efficient and successful posting.

Now, to the question you ask. The error is saying that the gsl installation cannot be found on your system. Instructions on how to install ROOT and its dependencies can be found here.

Best,
Danilo

Thank you very much for your response Danilo! So what would you recommend I should do? I recently saw that there is a new update for my root version. Or maybe try to install ROOT all over again or in another computer?

Hi Jorge,

This is not related to ROOT. You should simply install GSL on your system. If there are other problems, don’t hesitate to come back with other questions.

Cheers,
D

And if installing on Ubuntu is required, the command, according to this thread, should be

sudo apt-get install libgsl-dev

Best,
D