Hi guys,
I am not able to find a way to ensure that the roots from the algebraic solver remains positive. Is there a way to set constraints for the unknowns or parameters to make sure that only the positive roots of the equation are returned?
This is how my solver function looks like,
vector system(vector x, // unknowns
vector p, // parameters
real[ ] x_r, // data (real)
int[ ] x_i)//,
// real rel_tol,
// real f_tol,
// real max_steps)
{ // data (integer)
vector[1] z;
z[1] = p[1]*x[1]^4 + p[2]*x[1]^3 + p[3]*x[1]^2 + p[4]*x[1]^1 + p[5];
return z;
}
Thanks,