Re: [ROOT] TF1 with severals TFormula

From: Patois Yannick (patois@ganil.fr)
Date: Thu Mar 15 2001 - 17:19:33 MET


>     I am wondering if in the TF1 class exist the possibility to create a
> function with several formulae inside (for differents windows in x). The
> equivalent to:
> 
> 
>             /
>             |   x+1.      0.<x<=1.
>             |
> f(x) =  |  x^2        1.<x<=10.
>             |
>             |  sqrt(x)   10.<x<=20.
>             \

You can use any C comparaison function (they return 1 when true, zero
when false), eg:
TF1
f1("f1","(x+1)*(x>0)*(x<=1)+(x^2)*(x>1)*(x<=10)+sqrt(x)*(x>10)*(x<=20)",0,20);

If your needs become more complex, then use a custom function. See how
the TF1 function "fitf" is created form the fitf() C function in the
tutorial:
http://root.cern.ch/root/html/examples/myfit.C.html

	Yannick



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:21 MEST