Numerical Minimization

LineNumericalMinimization.C (6.7 KB)

The ROOT::Math::Functor class reference doesn’t give precise indication of how to use it with the abstract minimizer class ROOT::Math::Minimizer.

In the attached code, I show how to use it Functor for different versions of ROOT.

Hi @Andrea_Capra,

thanks for sharing!

I see that your example builds on top of an existing tutorial:

One difference is that you use a member function as the evaluation function in the functor.

In my opinion, using a lambda would be a bit more idiomic in modern C++ compared to the std::mem_fn:

    ROOT::Math::Functor f([&](double const * x){ return line.Eval(x); }, 2);

By the way, are you posting this here because you are suggesting updates to the ROOT tutorials and documentation?


Hi @jonas ,

the goal of this example is to understand what this meant

from ROOT: ROOT::Math::Functor Class Reference
Also I needed to understand the difference between ROOT versions, which causes troubles here.

Finally, I apologize if this is was not right place to post this.
Since this is not a question, but a potential “solution” to someone else problem.