Suppose that I have a function f which takes n parameters. And I want to minimize this function. But I want to variate only n-k parameters. At the same time I should pass all parameters to the function (sounds strange, I know, but it is program’s flaw):

FunctionToMinimize( const double* allParameters ){
//do staff with them
}
...
//I want something like the following
for( int i = 0; i < n; i++){
if(/* I want to minimize this parameter */){
Minimizer->SetLimitedVariable( i, "ivarToMin", step, ll, lo );
}
else{
Minimizer->SetVariable( i, "ivarToNotMin" );
}

Two questions:
Is it possible to do something like that? And If so, what I’ll get from X() method after the minimization? What it will be with “stable” variables?

EDIT: One more question. When I use SetFunction method should I provide number n or n-k:

ROOT::Math::Functor functor( &FunctionToMinimize, n /*or n-k*/ );

I think the total number of parameters remains constant and you should be able to use: Minimizer->SetFixedVariable( i, "ivarToNotMin", value ); // new fixed variable and / or: Minimizer->SetVariable( i, "ivarToNotMin", value, step ); // new free variable
Minimizer->FixVariable( i ); // fix an existing variable
Note: there is also: Minimizer->ReleaseVariable( i ); // "free" an existing "fixed" variable

Define you function with n parameters. This means also n should be used when creating the ROOT::Math::Functor class. Then you need to defined n-k variable parameters using either Minimizer::SetVariables or Minimizer::SetLimitedVariables and k fixed parameters using MInimizer::SetFixedvariables.

Define your function with n-k parameters. In this case the double * array used to in f(double*) should be of n-k dimension and the same value should be used when creating the Functor.
Also in this case no parameter needs to be defined as fixed.

Thank you, I use the 1st case. Here is a question. Is there explicit method to know minimized function value at the found minima? I do not see it in class reference.