Mathematica function minimization

Dear ROOT Talkers,

I have a function of ~ 20 parameters, of which I would like to find the minimum
using Minuit or Fumili within ROOT.
The problem is that this function is evaluated, for every choice of the parameters,
within Mathematica. Such function cannot (easily) be rewritten in C, since it uses
various Mathematica-specific functions (eg numerical solution of differential equations).

So, basically I would like to interface a function evaluation within Mathematica,
with a minimization algorithm within ROOT. Is this possible at all?

Many thanks in advance,

Yes, you can do this by defining your function to be minimized as a free function of type :

void fcn(Int_t&, Double_t*, Double_t&f, Double_t*, Int_t)

and implement it by calling Mathematica functions from C++.
See for example this on how to use Mathematica from ROOT

Best Regards


Hi Lorenzo,

thank you for your fast reply. Your link seems to be exactly what I need.

Have a nice day,