[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Use of Macro GSL_FN_EVAL

From: Luis Dias
Subject: [Help-gsl] Use of Macro GSL_FN_EVAL
Date: Thu, 13 Apr 2006 18:14:21 -0400
User-agent: Thunderbird 1.5 (Windows/20051201)


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

#define GSL_FN_EVAL(F,x)

(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?)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]