# MultiDimensional Minimisation with multiple parameters

Hello,

I am trying to understand the examples given here:

https://root.cern.ch/numerical-minimization#multidim_minim

The problem is that the examples use a Functor which only takes in one argument. I want to use a function which has multiple parameters like:

double RosenBrock(double xx ,double A, double B)
{
const Double_t x = xx;
const Double_t y = xx;
const Double_t tmp1 = y-x
x;
const Double_t tmp2 = 1-x;
return 100tmp1tmp1+Btmp2tmp2+A;
}

OR

how would I minimise a TF2 which is like A+Bx+Cx*y where A,B and C are all paramters which are assigned values by me before the minimisation process?

Would I do something like:

TF2 *f2=new TF2(“f2”,"+*x+xy",0,10);
f2->SetParamters(1,2,3);

ROOT::Math::GSLMinimizer min( ROOT::Math::kVectorBFGS );

min.SetMaxFunctionCalls(1000000);
min.SetMaxIterations(100000);
min.SetTolerance(0.001);

min.SetFunction(f2);

double step = {0.01,0.01};
double variable = { -1.,1.2};

// Set the free variables to be minimized!
min.SetVariable(0,“x”,variable, step);
min.SetVariable(1,“y”,variable, step)

min.Minimize();

ROOT Version: 6.14.04
Platform: Ubuntu 18.04
Compiler: 7.4.0

@moneta can help with this minimization issue.

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