Re: [ROOT] tiny Bug in root

From: Valeri Fine (fine@bnl.gov)
Date: Fri Nov 30 2001 - 19:16:17 MET


> Hi,
> 
> there is a way to obtain the desired behaviour by defining the function
> in the proper way:
> 
> root [0] TF1* f1 = new TF1("f1","(sin(x)/x)*(x>0.0)+ 1.0*(x==0.0)",0,10)

I am not sure this trick helps much  because the quantity of the "floating point"
numbers is limited rather infinite as the pure math claims for "real" numbers 
(see some numerical calculation book or "Fortran language manual"  for further explanation) 
and the number of points between any two floating-points is finite too.
The books explain why one can not rely on the floating-point  expression like "x == 0.0" either.
As result the expression above is not better then the oriogibnal one but more complex to understand
At least the same result one can get with 

Float_t epsilon = 0.0001;   // How to choose that epsilon many books explain.
TF1* f1 = new TF1("f1","(sin(x)/x),epsilon,10)

   Hope this helps, 

                            Best regardes, Valeri

> root [1] f->Eval(0)
> (Double_t)1.00000000000000000e+00
> root [3] f->Eval(1.0)
> (Double_t)8.41470984807896505e-01
> 
> I'm not sure whether you run into problems when doing a fit with this, though.
> 
> best,
> Kurt
>  
> > > Dear ROOTERs,
> > > 
> > > I have a test on the following code:
> > > 
> > > TF1 f1("func1", "sin(x)/x", 0, 10)
> > > f1.Eval(0),
> > > 
> > > 
> > > It gives the value 0 instead of 1.
> 
> -- 
> Kurt Rinnert, University of Karlsruhe (TH) - Faculty for Physics
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:10 MET