0
点赞
收藏
分享

微信扫一扫

8行代码求解非线性方程


Talk is cheap show me the code

from scipy.optimize import fsolve
from math import exp ,sin
def f(x,*arg):
f1=exp(x)+sin(x)
f2=0.2
return(f1-f2)
result=fsolve(f,x0=0)
print(result)

[-0.45173218]

什么牛顿法,拟牛顿法,二分法,都在库里。。。。。


举报

相关推荐

0 条评论