This answer to this question works only for situations in which the desired solution to the coupled functions is not restricted to a certain range.

But what if, for example, we wanted a solution such that 0 < x < 10 and 0 < y < 10?

There are functions within scipy.optimize that find roots to a function within a given interval (e.g., brentq), but these work only for functions of one variable.

Why does scipy fall short of providing a root solver that works for multi-variable functions within specific ranges? How might such a solver be implemented?

  • 1
    $\begingroup$ Transform your variables so they remain restricted. $\endgroup$
    – boyfarrell
    Sep 14, 2015 at 16:08
  • 1
    $\begingroup$ Numerical Recipes has a good discussion on multivariate root finding, and all the evilness that an extra dimension adds that you can trip on. $\endgroup$
    – Davidmh
    Sep 15, 2015 at 19:16

1 Answer 1


This is multivariate optimization with bound constraints (if you want to look it up in the literature). The TAO software can solve these problems if you want true optimization. If all you want is the solution of nonlinear equations with bounds, you can use the SNESVI solver in PETSc.


Your Answer

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

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