Analytic derivatives in fit

Hi All!

I’ve got a question about fitting.
Is there any way of setting analytically calculated derivatives, instead of calculate them each time numerically?

My thanks for your answers and corrections!

Hi,

Yes you can tell Minuit to use the analytical derivatives. Which interfaces are you using for fitting, TH1::Fit or the Fitter class or directly Minuit ?

Cheers

Lorenzo

The first one. TGraph::Fit.

Hi,

By using the “G” option when calling TH1::Fit, Minuit will not compute internally the derivatives. However the TF1 does not implement by default the analytical derivatives. You would need to re-implement yourself a derived class of TF1 wich re-impelment the TF1::GradientPar method using analytical derivatives.

Best Regards

Lorenzo

Thank you, but i still can’t understand how to re-implement it?
Something like that?:

class my_TF1: public TF1
{
public:
     Double_t Gradient_par(Int_t ipar, const Double_t* x, Double_t eps = 0.01)
     {
     	....
     }
}
{
...
my_TF1* myf = new TF1("f1","[0]+x*[1]",0,10);
th1->Fit(myf);
...
}