In my case these par (parameters p[0],p[1],p[2]) will be determinated by gMinuit but gsl_integration_qagiu need only a function f(x) to obtain a result. So, when I do this
Double_t integrand(float R, Double_t *par){
gsl_integration_workspace *work_ptr =
gsl_integration_workspace_alloc (1000);
double result; /* the result from the integration */
double error; /* the estimated error from the integration */
gsl_function F;
F.function = &f1;
Double_t value6= gsl_integration_qagiu(&F,R,1.0e-8,1.0e-8,1000,work_ptr, &result,&error);
return result;
}
has the problem of f(x,R,par). Root gives me this message
assigning to ‘double (*)(double, void )’ from incompatible type 'Double_t ()(float, Double_t *)’:
type mismatch at 1st parameter (‘double’ vs ‘float’)
F.function = &f1;
I need to define this function before doing the fit.
error: assigning to 'double (*)(double, void *)' from incompatible type 'Double_t (*)(float, float, void *)':
different number of parameters (2 vs 3)
F.function = &f1;
If you want to use directly gel you need to use the right type. Look at the User guide of GSL as gal_function is defined, and you need to define your function exactly in the same way.
Otherwise if you use the Integrator class in ROOT, which is based on GSL you don;'t need all this and it is much simpler to use.
Thank you for the code. But I really do not understand completely what you would like to to.
Your function Sigma calls Integrand which seems to try to compute an integral between 1 and + infinity of the function f1(x, parameters). But you do not pass the parameters from Sigma to Integrand.
Can you maybe explains in English or Math formula (even better) what you would like to do ?
One more comment, I would not mix floating precision with double. Just use double everywhere instead of float.
I want to implement these equations
\begin{equation}
\sigma_{los}^2 ® = \frac{3}{2r_{half}}\left( 1 + \left(\frac{R}{r_{half}}\right)^2\right)^2\int_R^\infty \frac{M(y)y^{2\beta-2}FF(\beta,R,y)}{\left(1+ \left(\frac{y}{r_{half}}\right)^2\right)^{5/2}} dy
\end{equation}
where $ \beta, r_{half}, M_s, r_s$ are my fit parameters and