Re: [ROOT] Getting a function maximum position

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jan 28 2003 - 17:59:20 MET


Hi Allister,

Your suggestion was simple to implement. Now in CVS.
see: 
  http://root.cern.ch/root/htmldoc/TF1.html#TF1:GetMaximumX
Example
TF1 *f1=new TF1("f1","sin(x)/x",-2,10);
f1.GetMaximumX();
f1.GetMaximumX(4,9);


Rene Brun

Allister Levi Sanchez wrote:
> 
> Hi Root folks,
> 
> If I want to find automatically the x-axis position of a 1-d
> user-defined function's peak, is there a function that does like
> TF1::GetMaximumX()?  For now I have to resort to dividing a given x-axis
> range into small intervals and do a TF1::Eval() and save them into an
> array.  Then I do a TMath::Sort() on that array in order to find the
> peak's index, then convert the index into position value.  Of course, if
> the ROOT development team says that's an unnecessary feature, I'd
> respect that.  Or is there some Root class I overlooked that does the
> job?...
> 
> Cheers,
> Allister Levi Sanchez
> Niigata University
> Japan



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET