Hello everyone,
I have a problem in accessing the Legendre polynomials but it is not as simple as just enabling Mathmore when configuring ROOT. Firstly, I run ROOT v5-34-00-patches installed on Ubuntu 18.04. The configure script that I used now was:
./configure --enable-mathmore --enable-minuit2 --enable-gsl-shared --disable-fitsio
and then I ran make, of course, and everything seems to be working well. The problem that I’m having is that, while I can compile and run the Legendre scripts in the root tutorials in “~/root/v5-34-00-patches/tutorials/math/”, I am not able to use “ROOT::Math::legendre” directly (for lack of a better word). Please see the attachment which has a snippet of my code.
The scripts in the tutorial folder work perfectly as they use a TF1 when declaring the Legendre function:
L[nu]= new TF1(“L_0”, “ROOT::Math::legendre([0],x)”, -1, 1);
However, for my research I can’t just use the TF1 in my fit function shown in the attachment.
The code fails when I run it because ROOT does not seem to be linking to the Legendre polynomials in the gsl library.
When in ROOT and using the tab button to autocomplete, I get the following:
root [23] ROOT::Math::l
lgamma
landau_pdf
lognormal_pdf
landau_cdf
landau_cdf_c
lognormal_cdf_c
lognormal_cdf
landau_xm1
landau_xm2
lognormal_quantile_c
lognormal_quantile
landau_quantile
landau_quantile_c
root [23] ROOT::Math::l
So you see that some of the functions are present but others are not (such as the Legendre and associated Legendre polynomials).
To get around this problem I had to do “#include </usr/include/gsl/gsl_sf_legendre.h>” at the start of my script and use the function directly as:
result += pars[L] * gsl_sf_legendre_Pl(2*L,x[0] * TMath::Pi()/180.);
This worked. So all of the files are present where they should be but ROOT is just not finding some of them which is odd. Is there anyone that can advise on this matter?
I would like to find a solution other than just installing the latest ROOT v6
as I know that the scripts that I have written for my PhD (final year) may suddenly encounter errors that ROOT v5 does not show.
FitFunction.cpp (197 Bytes)