Re: [ROOT] nested calls in TF1

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Feb 05 2001 - 17:23:10 MET


Hi Mikhail,
Nested function calls are not allowed in the TF1 constructor that you are using.
You should write a small interpreted or compiled function with this kind
of statements and use the corresponding TF1 constructor.
Example:

Double_t pow2(Double_t *x, Double_t *par)
{
   Double_t xx = x[0];
   return TMath::Power(TMath::Power(xx,2),2);
}
     
void powpow()
{
  TCanvas *c1 = new TCanvas("c1","the fit canvas",500,400);
  TF1 *pow2 = new TF1("pow2",pow2,-2,2,0);
  pow2->Draw();
}


Rene Brun

Mikhail Jabitski (Zhabitsky) wrote:
> 
>         Dear ROOT'ers!
> 
> It looks that TF1 doesn't analyze properly expressions with nested calls of
> pow():
> 
> root [0] TF1 *f = new TF1("f","pow(pow(x,2.0),2.0)")
> 
> *ERROR 22 :
>  POW requires two arguments
> root [1]
> 
> Best regards,
>                Mikhail
> 
> PS
>  I use ROOT 2.25/03



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET