Solving system of nonlinear equations with python

前端 未结 3 1867
面向向阳花
面向向阳花 2021-01-12 06:54

Can I solve a system of nonlinear equations in terms of parameters in python? Is there a example or tutorial? I can do this easily in maple, but the expressions for my parti

3条回答
  •  生来不讨喜
    2021-01-12 07:19

    SymPy might help; I don't know how good it is at solving non-linear equations: http://scipy-lectures.github.io/advanced/sympy.html#id23

    You should be able to execute code like (following from theexamples linked above):

    from sympy import *
    x = Symbol('x')
    y = Symbol('y')
    z = Symbol('z')
    beta = Symbol('beta')
    rho = Symbol('rho')
    sigma = Symbol('sigma')
    
    solve([sigma*(y-x), x*(rho-z)-y, x*y-beta*z], [x, y, z])
    

    I haven't tested if it works (I don't have it handy to this machine).

提交回复
热议问题