Visualizing Newton's Method for √2
Loading video...
Manim Animation Specification: Newton's Method with Default Settings
1. Animation Description & Purpose
Create a clear visual demonstration of Newton's method for finding a root of a function. The animation will show the function curve, the tangent line at the current iterate, and the successive approximations converging to the root. This helps viewers understand how the tangent line intersects the x‑axis and provides the next approximation.
2. Mathematical Elements
- Function:
- Derivative:
- Newton Update Formula:
- Initial Guess:
- Number of Iterations Displayed: 5 (i.e., through )
- Root:
3. Visual Elements
| Element | Description | Color | Style |
|---|---|---|---|
| Axes | Standard Cartesian axes with tick marks from to on x‑axis and to on y‑axis. | Gray | Axes with x_range=[-1,3,1], y_range=[-1,3,1] |
| Function Curve | Plot of . | Blue (#1f77b4) |
Smooth Graph with stroke_width=3 |
| Tangent Lines | Tangent at each iterate extending to intersect the x‑axis. | Red (#d62728) |
Dashed line, stroke_width=2 |
| Iterate Points | Small circles at each on the curve. | Green (#2ca02c) |
Dot with radius 0.08 |
| Root Marker | Larger dot at the true root . | Gold (#ffbf00) |
Dot radius 0.12 |
| Text Annotations | Formula, iteration number, and convergence note. | Black | Tex objects |
4. Animation Timing & Transitions
| Step | Action | Duration |
|---|---|---|
| 1 | Fade‑in axes and function curve. | 1.5 s |
| 2 | Show initial point on curve (dot) and display formula . | 2 s |
| 3‑7 | For each iteration : |
- Draw tangent line at .
- Extend line to x‑axis, highlight intersection as next point .
- Fade‑in new dot at .
- Update on‑screen iteration counter.
| 2 s per iteration (total 10 s) |
| 8 | Highlight convergence: draw a small gold dot at and fade‑out previous tangents, leaving only the curve and final point. | 2 s |
| 9 | Pause for 2 s, then fade‑out everything. | 2 s |
Total runtime ≈ 19.5 seconds.
5. Camera Angles & Perspective
- Static Camera: The camera remains fixed, showing the full view of the axes and curve throughout the animation. No zoom or pan is required because the default view comfortably contains all elements.
6. Additional Annotations
- Formula Display: At the start, a
Texobject shows the Newton update formula centered above the axes. - Iteration Counter: A
Texobject in the top‑right corner updates each iteration (e.g., "Iteration 1", "Iteration 2", …). - Root Label: After convergence, a small label "" appears next to the gold dot.
7. Implementation Sketch (Manim Community Edition)
from manim import *
class NewtonMethodDefault(Scene):
def construct(self):
# Axes
axes = Axes(x_range=[-1, 3, 1], y_range=[-1, 3, 1],
axis_config={"include_numbers": True})
axes_labels = axes.get_axis_labels(x_label="x", y_label="y")
self.play(FadeIn(axes), FadeIn(axes_labels))
# Function
f = lambda x: x**2 - 2
graph = axes.plot(f, x_range=[-1, 3], color=BLUE)
self.play(Create(graph))
# Newton method parameters
x_n = 2.0
iterations = 5
dot_radius = 0.08
formula = MathTex(r"x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}").to_edge(UP)
self.play(Write(formula))
# Initial point
point = Dot(axes.c2p(x_n, f(x_n)), radius=dot_radius, color=GREEN)
self.play(FadeIn(point))
# Iteration counter
counter = MathTex(r"Iteration\ 0").to_corner(UR)
self.play(Write(counter))
for i in range(iterations):
# Tangent line
slope = 2 * x_n
tangent = axes.get_tangent_line(x_n, graph, length=6, color=RED).set_style(stroke_dasharray=[6, 3])
self.play(Create(tangent))
# Intersection with x‑axis -> next x
x_next = x_n - f(x_n) / slope
intersect = Dot(axes.c2p(x_next, 0), radius=dot_radius, color=RED)
self.play(FadeIn(intersect))
# New point on curve
new_point = Dot(axes.c2p(x_next, f(x_next)), radius=dot_radius, color=GREEN)
self.play(FadeIn(new_point))
# Update counter
new_counter = MathTex(fr"Iteration\ {i+1}").to_corner(UR)
self.play(Transform(counter, new_counter))
# Prepare for next iteration
self.remove(tangent, intersect)
point = new_point
x_n = x_next
# Show true root
root_dot = Dot(axes.c2p(np.sqrt(2), 0), radius=0.12, color=GOLD)
root_label = MathTex(r"\sqrt{2}").next_to(root_dot, DOWN)
self.play(FadeIn(root_dot), Write(root_label))
self.wait(2)
self.play(FadeOut(VGroup(*self.mobjects)))
8. Summary
This specification uses sensible defaults to illustrate Newton's method on starting from over five iterations. The visual style, timing, and annotations are chosen to make the convergence process intuitive and engaging.
Created By
Description
An animation of Newton's method applied to f(x)=x²‑2. Starting from x₀=2, the curve, tangent lines, and successive points are shown for five iterations, converging to the true root √2. The axes, formula, iteration counter, and a gold marker highlight the process, using blue, red, green, and gold colors to illustrate each step.
Created At
Dec 25, 2025, 06:58 AM