help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Use of Macro GSL_FN_EVAL


From: Jerome BENOIT
Subject: Re: [Help-gsl] Use of Macro GSL_FN_EVAL
Date: Thu, 13 Apr 2006 23:44:31 +0100
User-agent: Debian Thunderbird 1.0.7 (X11/20051017)

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
address@hidden
http://lists.gnu.org/mailman/listinfo/help-gsl


--
Jerome BENOIT
jgmbenoit_at_mailsnare_dot_net




reply via email to

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