Solve a pair of coupled nonlinear equations within certain limits

回眸只為那壹抹淺笑 提交于 2020-01-06 16:23:15

问题


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? Another way of thinking about this is, what if the coupled functions are undefined when x or y is, e.g., less than zero?

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:


This is algorithmically nontrivial. A future scipy version is likely to have this sort of routine.

Today, you can cast your root finding problem into a least-square problem (minimize the sum of squares of lhs), and use the master branch of the scipy Git repo.



来源:https://stackoverflow.com/questions/32554729/solve-a-pair-of-coupled-nonlinear-equations-within-certain-limits

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!