Re: [ROOT] TFormula

From: K.-Michael Aye (
Date: Tue Jul 20 2004 - 10:17:37 MEST

Hi Rene,

thanks for your answer.
I hate to be picky, but then the docs for 305 are wrong.
This is from root doc305/TFormula.html#TFormula%3Adescription:

"  TMath functions can be part of the expression, eg:
*-*     -  TMath::Landau(x)*sin(x)
*-*     -  TMath::Erf(x)

Apart from that, just out of educational curiosity, how comes, that some 
TMath functions work, e.g.:

root [0] form= new TFormula("form","TMath::Power(x,4)")
(class TFormula*)0x9040840
root [1] form.Eval(2)
root [2]

Did you have to implement the TMath-functions by hand? Because if you 
wrote some kind of wrapper or so to include that functionality into 
TFormula, either all or none of the functions should work, or shouldn't 
As I said, I am just puzzled about that and wondered how the partial 
implementation has happened. Only because the power function worked, I 
came to the idea of using more TMath inside my stuff.


Rene Brun wrote:
> Hi Michael,
> Move to a more recent version (eg 4.00/08).
> The possibility to call the TMath functions from TF1/TFormula was only
> implemented a few months ago. With 4.00/08, I get:
> root [0] TFormula form("form","TMath::Sigma()*TMath::Power(x,4)");
> root [1] form.Eval(1)
> (Double_t)5.67040000000000030e-008
> root [2] TFormula form1("form1","TMath::Sigma()*5")
> root [3] form1.Eval(1)
> (Double_t)2.83520000000000040e-007
> Rene Brun
> On 
> Mon, 19 Jul 2004, K.-Michael 
> Aye wrote:
>>I get SEGV during runtime in compiled program and in CINT with this:
>>TFormula form("form","TMath::Sigma()*TMath::Power(x,4)");
>>If I replace it with the value of the SB-constant, it works fine.
>>Also a declaration of
>>TFormula form("form","TMath::Sigma()*5")
>>doesn't work (I tried it for test purposes), so it seems the culprit is 
>>the TMath::Sigma function?
>>I'm using Root 3.05/07 on gcc 3.2.2.

K.-Michael Aye, University of Durham, Dept. of Physics
Phone@Work: +44-191-334-3665, Fax@Work: +44-191-334-3521
"We all declare for liberty, but in using the same word,
we do not all mean the same thing." Abraham Lincoln

This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET