Newton's method (also known as the Newton-Raphson method) is an iterative algorithm for finding successively better approximations to the roots (or zeroes) of a real-valued function.
Given a function f(x) and an initial guess x_0, the method produces a sequence of approximations using the formula:
x_{n+1} = x_n - f(x_n) / f'(x_n)
At each step, the algorithm:
- Evaluates the function at the current guess
- Constructs the tangent line to the curve at that point
- Uses the x-intercept of the tangent line as the next guess
Under favorable conditions, the method converges quadratically to the root.
The method converges to the square root of 57 (approximately 7.5498):
The method converges to x = 1 (a root of x^2 - 1):
In each plot:
- The green curve is the function f(x)
- Blue dots on the x-axis are the successive guesses
- Red dots on the curve show where f is evaluated
- Blue lines are the tangent lines at each iteration
- Dashed gray lines connect each guess to the curve
| File | Description |
|---|---|
sage_code |
Original SageMath implementation |
newtons_method.py |
Python 3 translation with matplotlib visualization |
newtons_method_x2_57.png |
Visualization for f(x) = x^2 - 57 |
newtons_method_x2_1.png |
Visualization for f(x) = x^2 - 1 |
python3 newtons_method.pyYou can also run the original SageMath code on SageMathCell.
- Newton's method converges very quickly (quadratic convergence) when the initial guess is close to the root
- The method requires the derivative f'(x) to be known
- It may fail to converge if the initial guess is too far from the root, or if f'(x) = 0 at some iteration

