# fsolve with multiple tolerance levels

14 views (last 30 days)
Alessandro Cerusico on 5 Apr 2021
Edited: Matt J on 5 Apr 2021
I am trying to numerically solve a system of the form , where the 's are pre-specified numbers. The 's are computed through a simulation (i.e. they don't come from closed-form expressions) and depend on a series of ten parameters, the choice variables in the problem. So far, I have been using fsolve.
Is there any way to specify a different tolerance level for each of the equalities?
The same problem could be stated as a series of inequalities - where is the specific tolerance level. In this case it would be sufficient, for each i, to find at least one parameter value that produces a satisfying the inequality. If this formulation is better, can you suggest a function that can deal with it?

Matt J on 5 Apr 2021
Edited: Matt J on 5 Apr 2021
You can use fmincon (instead of fsolve) to formulate the tolerances as nonlinear inequality constraints. Or you can use lsqnonlin to minimize where are additional unknown slack variables that you would add to your problem.
Rather than striving for exact tolerances on each of the terms, though, it may be worth considering the simpler approach of simply weighting your equations differently in fsolve, .