Re: Use of parametrized formulae twice

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jan 11 2000 - 16:14:43 MET


Hi Davide,
Yes, I agree that it would be nice to have what you want.
This is currently implemented in TFormula only for very simple cases
such as the tutorial "fillrandom".
I already investigated how this could be supported. It appears not so
trivial.
The problem is that the basic functions (f1, f2 in your case) can be
used in more than one final function. This implies that each final
function must
have a copy of the parameters of the basic functions.
I had also several requests to build a new TF1 using existing TF1.
This will probably come one day, but not in the near future.

Rene Brun


Davide Cremonesi wrote:
> 
> Hello everybody.
> 
> I would like to define a set of parametrized formulae, e.g.
> 
> TFormula *f1 = new TFormula("f1","[0]*pow([1],[2])");
> TFormula *f2 = new TFormula("f2","[0]*sin([1]/[2])");
> etc...
> 
> and use them IN ANY ORDER in a TF1 object, for example:
> 
> TF1 *tf1 = new TF1("tf1", "f1 - [3]*f2", 0, 10);
> tf1->SetParameters(1,2,3,4,5,6,7);
> 
> which does not work because the first three parameters are used also in
> f2.
> I cannot (I don't want to) know in advance the order of f1,f2 ... fN in
> the expression
> and therefore cannot write:
> TFormula *f2 = new TFormula("f2","[4]*sin([5]/[6])");
> which indeed works.
> 
> If I use for example gaus or expo I can specify expo(4) to start
> numbering
> its parameters from 4 on, but in this case using "f1 - [3]*f2(4)" does
> not work.
> 
> Any suggestion on how to proceed?
> 
> Thanks in advance,
> Davide Cremonesi



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:16 MET