# Re: TF1 Syntax ...

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Fri, 24 Feb 2006 08:53:47 +0100 (MET)

Both answers are correct. You simply misunderstood what TMath::DegToRad() is doing, ie pi/180

Rene Brun

On Fri, 24 Feb 2006, zaldy wrote:

>
> Hi,
>
> Just want that I will be using with degree units in carrying a calculation
> but,
>
> What is wrong with (1) expression?
>
> ======================================================================
> NOTE: It seems the operation is OK because ROOT does not complain about
> the writing of parameter [0] in expression "cos([0]*x)".
> ======================================================================
>
> 1 ----WRONG
> root [0] TF1 * f = new TF1("f","pow(cos([0]*x),2)",0,90);
> root [2] cout<<"f Integral(0,90) = "<< f->Integral(0,90) << endl;
> f Integral(0,90) = 45 <----WRONG
>
>
> 2 -----CORRECT-----
> root [4] TF1 * f = new TF1("f","pow(cos(x),2)",0,90);
> root [5] cout<<"f Integral(0,90) = "<< f->Integral(0,0.5*TMath::Pi()) << endl;
> f Integral(0,90) = 0.785398 <----- CORRECT
>
>
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 4.04/02 6 June 2005 *
> * *