Skip to main content
1-Visitor
Jul 27, 2015 10:24 AM UTC
Question

Strict enforcement of boundary conditions

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
Jul 27, 2015 2:30 PM UTC

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.

Translate
swahlgren1-VisitorAuthor
1-Visitor
Jul 30, 2015 9:53 AM UTC

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

Translate
19-Tanzanite
Jul 30, 2015 11:42 AM UTC

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

Translate