简体   繁体   English

python有没有替代的Scipy fsolve?

[英]Is there any alternative Scipy fsolve for python?

I'm sure this question has been addressed several times but unfortunately, none of the methods presented helped my situation.我确信这个问题已经被多次解决,但不幸的是,所提供的方法都没有帮助我的情况。 I am trying to solve a complicated study using Scipy fsolve, but the solver is extremely sensitive to the initial conditions.我正在尝试使用 Scipy fsolve 解决一个复杂的研究,但求解器对初始条件非常敏感。

My question: Is there any alternative fsolve?我的问题:有没有替代的 fsolve? if not is there any way to adjust the sensitivity?如果没有有没有办法调整灵敏度?

For fsolve, you can adjust the xtol so that it terminates if the relative error is at most xtol (ie convergence parameter). 对于fsolve,您可以调整xtol,以便在相对误差最多为xtol(即,收敛参数)的情况下终止。 Meaning that xtol measures the relative error desired in the approximate solution. 意味着xtol测量近似解中所需的相对误差。 Toggling this will decrease the sensitivity of the solver. 切换此选项将降低求解器的灵敏度。 You can find out to change that in the scipy docs: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fsolve.html 您可以在scipy docs中找到更改的方法: https ://docs.scipy.org/doc/scipy/reference/generation/scipy.optimize.fsolve.html

如果您使用fsolve求解方程f(x) = 0 ,您有时可以使用scipy.optimize.fminscipy.optimize.minimize在函数|f(x)|²求解最小值来代替它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM