TF1 Syntax ...

From: zaldy <zaldy_at_neutrino.kek.jp>
Date: Fri, 24 Feb 2006 11:44:40 +0900 (JST)

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 [1] f->SetParameter(0,TMath::DegToRad());
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


  gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

-- 
Zaldy A. Nawang
Received on Fri Feb 24 2006 - 03:46:40 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET