Re: x**2

Valery Fine (Valeri.Faine@cern.ch)
Fri, 30 May 1997 18:36:56 +0100


On 30 May 97 at 17:37, Otto Schaile wrote:

> what do I wrong here:
> * Version 1.00/10 25 April 1997 *
> ....
> root [0] x2=new TFormula("x2","x**2")
> (class TFormula*)0x0
> root [1] xx2=new TF1("xx2","x2",400,1000)
>
> *ERROR 5 :
> Invalid Syntax "*"
>
> *** Break *** segmentation violation
>
Class TF1 has several constructors as follows:

class TF1
TF1(char* name, char* formula, Float_t xmin = 0, Float_t xmax = 1)
TF1(char* name, void* fcn, Float_t xmin = 0, Float_t xmax = 1, Int_t npar = 0)
TF1(char* name, Double_t (*)(Double_t *, Double_t *) fcn, Int_t npar = 0)

It has NO constructor like

TF1(char* name, TFormula *formula, ....)

even it had, your second expression must be re-writen like this

xx2=new TF1("xx2",x2,400,1000)
^
------ NO "x2"

Since TFormula has NO method to retrieve back the symbolic representation of that formula
there is no way to use TFormula class to define TF1 function.

One can do like this:

Char_t *formula = "x**2";
x2=new TFormula("x2",formula)
xx2=new TF1("xx2",formula,400,1000)

I'd like to highlight that in the real life there is no means to use TFormula and TF1 since
TF1 is defined as follows:

class TF1: public TFormula, ....

is TFormula !!!

Hope this helps

Valery
=================================================================
Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for NuclearRes Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su

Dr. Valeri Faine
------------ Phone: +41 22 767 6468
CERN FAX : +41 22 767 7910
CH-1211 Geneva, 23 mailto:fine@mail.cern.ch
Switzerland http://nicewww.cern.ch/~fine