У меня есть уравнение, похожее на это:
Код: Выделить всё
import numpy as np
from scipy.stats import norm
from scipy.misc import derivative
from scipy import optimize
a_=1
b_=1
x0=2
def f(x, a=a_, b=b_):
return (a*x*norm.cdf(b/x))
root = optimize.newton(f, x0, args=(a_, b_))
print(f"The root of the equation is approximately {root}")
Код: Выделить всё
RuntimeError: Failed to converge after 50 iterations, value is -0.12105344527421698.
Подробнее здесь: https://stackoverflow.com/questions/786 ... e-is-using