Scipy-具有线性约束的非线性方程组(初学者) [英] Scipy - Non-linear Equations System with linear constraints (beginner)

查看:292
本文介绍了Scipy-具有线性约束的非线性方程组(初学者)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了这个令人惊叹的示例. 但是我需要求解在X和F上具有边界的系统,例如:

I have seen this amazing example. But I need to solve system with boundaries on X and F, for example:

    f1 = x+y^2 = 0
    f2 = e^x+ xy = 0
-5.5< x <0.18
2.1< y < 10.6
   # 0.15< f1 <20.5 - not useful for this example
   # -10.5< f2 < -0.16 - not useful for this example

我怎样才能将此边界约束设置为scipy的fsolve()?还是可能有其他方法? 您能给我一个简单的代码示例吗?

How could I set this boundary constrains to fsolve() of scipy? Or may be there is some other method? Would You give me a Simple code example?

推荐答案

这取决于系统,但是在此之后,您可以简单地检查约束.

It depends on the system, but here you can simply check the constraints afterwards.

首先解决您的非线性系统,以得到(x,y)形式的一个/无/多个解.然后检查这些解决方案中有哪些满足约束条件.

First solve your nonlinear system to get one/none/several solutions of the form (x,y). Then check which, if any, of these solutions, satisfy the constraints.

这篇关于Scipy-具有线性约束的非线性方程组(初学者)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆