Fixing the value of the sum of multiple parameters

Hi,
I was wondering if there is a way to fix parameter limits on the sum of multiple parameters. Something like:
g->FixPar(1+2+3,1)
where 1,2,3 are fitting parameters and 1 is the value to fix the sum to. Is this in any way possible? I am trying to implement a constraint, which is why this would be useful.

_ROOT Version: 6.23/01
Platform: MacBook Pro
Compiler: Not Provided


Perhaps @moneta can help?

Hi,

This is currently not possible. There is not yet support for constraints which consists of function of parameters, instead only simple parameter bounds are supported.
In some simple cases as above, can be re-formulated by some parameter transformation .
For example defining q1 = p1; q2 = p2; q3 = p1+p2+p3;

Lorenzo

1 Like

Ah ok, I think this would work, thank you moneta!

Hello again,
It makes sense when you explain it, but I have trouble implementing it. Do you know how I could implement the following?
Screen Shot 2020-09-20 at 12.00.43 AM
where
Screen Shot 2020-09-20 at 12.00.49 AM .
Like how would I code the above equation as a TF1 pointer? Can you help?
The function is a function of only beta, and it has three parameters, p_1, theta, and p_2.

Hello,
try p1*[…]+(p2-p1)/4
0<=p2<=1

Why would this work, it is not the same function, and there is no limit on p_1?

Sorry, you are right!

Hello,
define your fit function for 0 <= p[1],p[2] <= 1 like this

double Pvv (double *x, double *p) {
  double A=cos(p[0])*cos(p[0]);
  double B=cos(x[0])*cos(x[0]);
  double a=p[1];
  if (a>1-p[2]) a=1-p[2];
  return a*A*B+p[2]/4;
}
1 Like

To some extent this works, but I still get

p[1]+p[2]>1

when I do the fit. I try to restrict the parameters, and then the above works, but I do not think it is ideal, since the only restriction should be that their sum is <=1.

Thank you for the answer though, I learned something new today from your post!

Maybe ROOT experts can suggest a better solution…

Unfortunately, as I said before, we don’t have yet the support for constraint minimisation, the only thing you can do is to set 0<= p1 <= 1 and 0 <= p2 <=1 and if the function minimum has p1+p2 <= 1 then it is fine.

Lorenzo