Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Newton's Method -- Step-by-Step Animation

Overview

This visualization shows Newton's method applied to f(x) = x^2 - 1, starting from x = 3, broken down into individual steps. Each panel captures one iteration of the algorithm, making it easy to see how the method converges to the root x = 1.

At each step:

  1. The current guess x_n is marked on the x-axis (blue dot)
  2. The function value f(x_n) is found on the curve (red dot)
  3. A tangent line is drawn at that point (blue line)
  4. The x-intercept of the tangent line becomes the next guess (orange diamond)

Visualization

Newton's Method Animated Steps

Each panel shows the cumulative progress: previous iterations appear faded in the background, while the current step is highlighted. Notice how the guesses rapidly converge toward x = 1.

Step Guess Next Guess
1 3.0000 1.6667
2 1.6667 1.1333
3 1.1333 1.0078
4 1.0078 1.0000
5 1.0000 1.0000

Files

File Description
sage_code Original SageMath implementation (generates animation frames)
newtons_method_animated.py Python 3 translation producing a multi-panel figure
newtons_method_animated.png Step-by-step visualization

How to Run

python3 newtons_method_animated.py

Key Takeaways

  • The tangent line approximation improves dramatically with each step
  • By step 4, the method has already found the root to 4 decimal places
  • This demonstrates the quadratic convergence of Newton's method: the number of correct digits roughly doubles each iteration