当前位置:首页>开发>正文

求大神中lingo做一下非线性方程组 python 编写简单方程

2023-04-18 23:48:31 互联网 未知 开发

 求大神中lingo做一下非线性方程组 python 编写简单方程

求大神中lingo做一下非线性方程组

4*x1-2*x2 3*y1-y2=0
-2*x1 4*x2 4*y1 4*y2=0
2*y1*x3=0
2*y2*x4=0
3*x1 4*x2 x3^2=6
x1-4*x2-x4^2 2=0
@free(x1)@free(x2)@free(x3)@free(x4)
@free(y1)@free(y2)

这个有多组解 lingo不限定范围只能做出一组 接近0的数当成0就行了 精度问题

python 编写简单方程

函数名不能有#
所以:
#!pythonimport re
def extract(s):
    return [i[1:] for i in re.findall(r#w ,s)]
print(extract(ABC #123ab! #abc))
print(extract(ABC #123ab! #123ab! #abc))运行结果:
[willie@bogon ~]$ pythonPython 3.5.2 (default, Sep 30 2016, 01:32:24) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> def extract(s):
... return [i[1:] for i in re.findall(r#w ,s)]
... 
>>> extract(ABC #123ab! #abc)
[123ab, abc]

非线性方程组求解,帮帮忙

这是利用MATLAB求解非线性方程租的过程
在MATLAB中提供了一个fzero函数,可以用来求单变量非线性方程的根。该函数的调用格式为:
z=fzero(fname,x0,tol,trace)
其中fname是待求根的函数文件名,x0为搜索的起点。一个函数可能有多个根,但fzero函数只给出离x0最近的那个根。tol控制结果的相对精度,缺省时取tol=eps,trace 指定迭代信息是否在运算中显示,为1时显示,为0时不显示,缺省时取trace=0。

最新文章