Home | News | Documentation | Download

TFitResult. derivative of the fit function from fit result. Any example, tutorial, please

Hi,
https://root.cern.ch/doc/master/classTFitResult.html
I want to get derivative of the fit function from fit result.
Any example, tutorial, please.

Thanks.
Regards. Veleriy

++
Offtopic.
Could you update ROOT web reference guide to the modern smartphone-friendly style.
Something like this
https://x2v0.github.io/TM/docs/api/TM/TM.html#sidetoggle

Hi,
I think you want to have the derivative of your model function you have used for fitting. Is it with respect to the observables x or the parameters ?
If the function is represented as TF1 object, you can do as in this tutorial example.
https://root.cern.ch/doc/master/exampleFunctor_8C.html

Lorenzo

Hi Lorenzo.
I need a derivative function for BFGS minimisation.
What is the best way do it with ROOT?

Thanks.
Regards. Valeriy

Hi,

In this case you need the derivative of the objective function, the chi2 or the likelihood function.
You can get these functions from the Fitter class and if you have built them with gradient support they provide a method to compute the gradient. See for example ROOT: ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType > Class Template Reference.

The tutorial ROOT: tutorials/fit/combinedFit.C File Reference showns an example on how to create the objective function and used it for fitting.
I can provide you an example where the gradient is used, but it is better you send me your code and I can modify to show how to get it in your code.

Lorenzo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.