← All projects

Basins of Attraction

Mapping which root Newton's method lands on, one pixel at a time.

The Newton fractal for z cubed minus one, three coloured basins meeting along a fractal boundary
The Newton fractal for z cubed minus one, three coloured basins meeting along a fractal boundary
Status
complete
When
Dec 2025
Grid
1000 x 1000 points
Course
Numerical Algorithms, BME

Role BME coursework. The solver, the plots and the write-up.

Newton's method finds a root, but which one depends on where you start. A vectorised solver runs the iteration on a million starting points at once and colours each by the root it lands on, which draws the fractal boundary where the answer stops being predictable.

What it is

Newton’s method finds a root by repeatedly following the tangent line. Which root it finds depends on where you start, and the map from starting point to root is far stranger than it sounds. This draws that map.

How

The iteration runs on a whole NumPy array at once rather than point by point, so a 1000 x 1000 complex grid, a million guesses, converges in seconds. Each point is then matched to its nearest root and coloured by it. The solver also returns how many iterations each point needed, which exposes the boundary on its own: points near it take far longer to make up their mind.

The interesting part

For something as plain as z cubed minus one, the three basins do not meet along clean lines. Every boundary point has all three basins arbitrarily close to it, so a tiny change in the starting guess sends you to a different root entirely.

A small project, but a clean demonstration of a deterministic algorithm whose outcome is, in practice, unpredictable.

More

03 photos