Bounds on parameters in NumericalMinimization.C

Follow up questions from the post NumericalMinimization.C

1.Is there a way that I can put bounds on what my parameter values can be without randomizing them?
For example, in the macro how could I set the fit on x to only ever be from -5 to 5?

  1. Once, I test my program and before the minimum is displayed this message is printed:
    Minuit2Minimizer : Invalid Minimum - status = 2
    FVAL = 1.76505e-08
    Edm = 3.60266e-09
    Nfcn = 42

What do these parameters FVAL Edm and Nfcn mean?

Instead of:
min->SetVariable(0,“x”,variable[0], step[0]);
try:
min->SetLimitedVariable(0, “x”, variable[0], step[0], -5.0, 5.0);
Of course, the “initial value” variable[0] must be between -5 and 5, so if you want to “randomize” it, then you need to modify:
variable[0] = r.Uniform(-20,20);
into:
variable[0] = r.Uniform(-5.0, 5.0);

See also:
ROOT::Math::Minimizer
ROOT::Minuit2::Minuit2Minimizer

Note that, in the case of the ROOT::Minuit2::Minuit2Minimizer, for:
status -> see Minimize()
FVAL -> see MinValue()
Edm -> see Edm()
Nfcn -> see NCalls()