在一定范围内求解一对耦合非线性方程 [英] Solve a pair of coupled nonlinear equations within certain limits
问题描述
这个答案这个问题仅适用于耦合函数的期望解不限于特定范围的情况.
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.
但是,例如,如果我们想要一个解决方案,使得 0 <×<10
和 0
x
或 y
小于零时,如果耦合函数未定义怎么办?
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?
scipy.optimize
在给定区间内找到函数的根(例如,brentq
),但这些仅适用于一个变量的函数.
为什么 scipy
无法提供适用于特定范围内的多变量函数的根求解器?如何实现这样的求解器?
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?
推荐答案
这在算法上很重要.未来的 scipy 版本很可能会有这种例程.
This is algorithmically nontrivial. A future scipy version is likely to have this sort of routine.
今天,您可以将求根问题转化为最小二乘问题(最小化 lhs 的平方和),并使用 scipy Git 存储库的主分支.
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.
这篇关于在一定范围内求解一对耦合非线性方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!