Skip to main content
1-Visitor
July 27, 2015
Question

Strict enforcement of boundary conditions

  • July 27, 2015
  • 24 replies
  • 6374 views

Dear PTC Community

From a set of x and corresponding y values I'm trying to solve a system of equations and for this I'm of course using a set of boundary conditions. One of these is that all solution values are equal to or above zero (i.e. non-negative) but despite using the minerr-function to solve the system I still get negative values. They are, however, quite small and the results are thus usable but it seems strange to me that the negative values can't be avoided. Is there a way to strictly enforce a boundary condition?

24 replies

19-Tanzanite
July 27, 2015

Constraints in minerr are soft constraints, not hard constraints. The errors in the constraints are minimized as part of the sums of the squares of all the errors, so they are not forced to zero (another way to look at it is that everything is a constraint, either an equality constraint such as f(x[i)=y[i, or an inequality constraint such as p>0. They are all treated equally.). If you want a hard constraint, weight it very heavily. So instead of p>0, use p*10^15>0. Or as another example, instead of p>2, use (p-2)*10^15>0.

swahlgren1-VisitorAuthor
1-Visitor
July 30, 2015

I've played around with it a lot and no matter how hard I weigh it I still can't avoid negative results.

19-Tanzanite
July 30, 2015

Without the worksheet I can't really say what is going on. How small are the negative values?