I would like to integrate a function with gsl. Therefor I have to define a function f (the integrant, which has to be of the form double (*)(double, void*)). For the call of the gsl integration method I need to define a struct, which contains a pointer to a function (this struct is called gsl_function).
gsl_function F;
F.function = &MyClass::my_f;
The function f must be implemented in a class (in the same class from which the integration procedure should be called). How can I assign the pointer above correctly, since the 2nd line is not compiling and leads to the error:
cannot convert ‘double (MyClass::*)(double, void*)’ to ‘double (*)(double, void*)’ in assignment.
Here the definition of my_f
 struct my_f_params { double a; double b;};
   double my_f (double x, void * p) {
   struct my_f_params * params = (struct my_f_params *)p;
   double a = (params->a);
   double b = (params->b);
   return 1.0/(sqrt(a * (1.0 + x)*(1.0 + x)*(1.0 + x) + (1-a) * std::pow((1.0 + x), (3.0 * (1.0 + b))))); 
    }
 
     
    