I have a function that I'm trying to minimize. It currently works reasonably well with this:

FindMinimum[{chiSquared[ber, btm, dsr, dcd], 
  0 < ber && 0 < btm && 0 < dsr && 0 < dcd}, {{ber, 1.}, {btm, 
   10^10}, {dsr, 1.}, {dcd, 1000}}]

But the conditions seem like extra work. Is there an easier way to tell these kinds of functions that they should only consider positive, real numbers when working on a solution?

  • $\begingroup$ I do it like this: vars = {ber, btm, dsr, dcd}; init = {1., 10^10, 1., 1000}; FindMinimum[{chiSquared[ber, btm, dsr, dcd], Thread[0 < vars]}, Thread[{vars, init}]] -- maybe it's better? $\endgroup$
    – Michael E2
    Apr 21, 2020 at 21:57

1 Answer 1


This seemed to do the trick:

FindMinimum[{chiSquared[ber, btm, dsr, dcd], Element[{ber, btm, dsr, dcd}, PositiveReals]}, {{ber, 1.}, {btm, 10^10}, {dsr, 1.}, {dcd, 1000}}];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.