Hello,

have you tried:

GSL_FN_EVAL(&F,x)


hth,
Jerome

Luis Dias wrote:

Hi,

Does anybody have an example of how to use the macro GSL_FN_EVAL  :

#define GSL_FN_EVAL(F,x)
        (*((F)->function))(x,(F)->params)


(to evaluate a gsl_function).
For instance, say I have the code that's in the manual (just changed some variable names for clarity):

=============================================

    struct three_numbers { double a; double b; double c; };
        double my_f (double x, void *p) {
       struct three_numbers *params1 = (struct three_numbers *)p;
       double a1 = (params1->a);
       double b1 = (params1->b);
       double c1 = (params1->c);
           return  (a1 * x + b1) * x + c1;
    }
        gsl_function F;
    struct three_numbers params_of_my_f = { 3.0, 2.0, 1.0 };
        F.function = &my_f;
    F.params = &params_of_my_f;


=============================================

How do I use GSL_FN_EVAL in this example, to evaluate, say F(10.0) and get 321.0? (it works by doing, say,double aux=my_f(10.0,&params_of_my_f) but can I do it using F?)

   Thanks!
   Luis



_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl


--
Jerome BENOIT
jgmbenoit_at_mailsnare_dot_net


_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to