This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts

demoAINumerics

Which root does Newton's method find?

Solve by Newton's method from every point of a square and color each start by the root it reaches. Near a root the answer is obvious. Along the lines between them it is a fractal: every boundary point touches all three basins.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

Newton's step for is . It commutes with complex conjugation, so the picture is symmetric top to bottom, and the two complex roots must attract exactly the same number of grid points; the test checks that the counts are equal, not merely close.

Printed

count: [0, 5576, 5404, 5404]
Basins of the three cube roots of 1
Im z
Re z
128 × 128 grid

Tests 3 of 3 pass

  • each root is a fixed point of the Newton step (passes)
  • every start on the grid has reached a root within 40 steps (passes)
  • the two complex roots attract the same number of grid points, because the step commutes with conjugation (passes)

Checked when the site was built: 3 of 3 tests passed, in 0.46 s. Download 2026-09-21-newton-basins.viv