Re: [ROOT] How to get the maximum and minimum of a function

From: Nick van Eijndhoven (Nick@phys.uu.nl)
Date: Wed Nov 06 2002 - 09:45:05 MET


Hi Rene,
Digging into my memory I think that I have written such a facility
quite some time ago, i.e. in Fortran when I was a student.
It also had a facility to provide the zero points of a function.
I'll see if I can find the code somewhere and transform it into C++;
basically the code for the Prob(), Bessel and Gamma functions came
from the same package.
I'll let you know when I have something, but can't promise anything :).

                                               Cheers,
                                                Nick.

Rene Brun wrote:
> 
> Hi Alexander,
> 
> Currently, you can only get an approximate value of the max/min of the
> function in a range by getting the max/min of the histogram used
> to draw the function.
> I agree that it would be nice to have two functions computing the real
> max/min. In fact, this function should return both the maximum of
> the function as well as the x value corresponding to the maximum.
> Any volunteer to implement this code?
> 
> Rene Brun
> 
> On Mon, 4 Nov 2002, Alexander Dietz wrote:
> 
> > Hello Rooters
> >
> > suppose I define a function like
> >
> > TF1* fun=new TF1("fun","[0] + [1]*x + [2]*x*x",0,1000);
> >
> > with three parameters that are given later from input (e.g. a file).
> > So how can I get the minimum and the maximum value (or position) of this
> > function within its defined range (here: 0 to 1000) ?
> >
> >
> > Cheers
> >
> >       Alexander Dietz
> >
> > -----------------------------------
> > Alexander Dietz
> > Max Planck Institut fuer Kernphysik
> > Saupfercheckweg 1
> > Postfach 10 39 80
> > D-69029 Heidelberg
> >
> > Phone: +49-6221-516-259
> >



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:16 MET