function pointer problem in TF1

From: Vlatko Balic (balic@huhepl.harvard.edu)
Date: Fri Jan 02 1998 - 16:46:41 MET


Hi -- I declare 2 TF1 functions (as function pointers) and try to use them
to define a third function. This does not seem to work. Here's the
example:

> double fun1(double *xVec, double *Param)
> {
>  double x, fVal;
>  x=xVec[0];
>  fVal=Param[0]*x*x + Param[1]*x + Param[0];
>  return fVal;
>}
>
>double fun2(double *xVec, double *Param)
>{
>  double x, fVal;
>  x=xVec[0];
>  fVal=Param[0]*x*x + Param[1]*x + Param[0];
>  return fVal;
>}
>
>TROOT root("TF1 test","TF1 test");
>
>void main()
>{
>  double Params[3]={1.0, 1.0, 1.0};
>
>  TF1 *f1 = new TF1("fun1", fun1, -10, 10, 3);
>  f1->SetParameters(Params);
>  TF1 *f2 = new TF1("fun2", fun2, -10, 10, 3);
>  f2->SetParameters(Params);
>  printf("\n f1(2)=%f", f1->Eval(2));
>  printf("\n f2(2)=%f", f2->Eval(2));
>
>  // the following statement  produces an error "ERROR 4 : Empty String"
>  TF1 *f3 = new TF1("fun3", "fun1 * fun2");
>}

This code generates the following output:
>
> f1(2)=7.000000
> f2(2)=7.000000
>*ERROR 4 : 
> Empty String

So, there's a problem when defining f3. Any comments? Thanks.
 
 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:29 MET