Find $x$ such that $f(x) = 0$. Newton's Method $$ x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} $$ 1def newton(f, df, x0, tol=1e-6, max_iter=100): 2 """Newton's method for root finding""" 3 x = x0 4 for i in range(max_iter): 5 fx = f(x) 6 if abs(fx) < tol: 7 return x 8 x = x - fx / df(x) 9 …
Read More