Afterglowscreensavers

Newton Fractal Screensaver

Newton Fractal is a free, in-browser screensaver that colours every pixel by which root of a polynomial Newton’s method converges to when started from that point, shaded by how many steps it took. The basins of the roots meet along a boundary that is fractal at every scale, and because the roots slowly move, that boundary reshapes continuously. Nothing to download, and ESC exits at any time.

Live preview

Newton Fractal screensaver — Basins of attraction with fractal borders.

Press ESC to leave fullscreen. Settings are saved in your browser only.

How the Newton Fractal screensaver works

Newton’s method finds a root of a polynomial by repeatedly stepping from a guess z to z − p(z)/p′(z). For a polynomial written as a product of its roots, p′/p is simply the sum of 1/(z − rₖ), so the step needs only the root positions and no explicit coefficients.

Every pixel is a starting guess. The saver iterates until z lands within a small distance of one of the roots, records which root and how many steps, and colours the pixel with that root’s hue darkened by the step count. Points near a basin boundary take many steps and come out dark, which is what draws the borders.

The roots start as the corners of a regular polygon — the roots of unity for degree 3 to 6 — rotated slowly by time, with one of them displaced on a small circle. Any movement of a root changes every basin, so the whole image flows.

Rendering happens into a downscaled offscreen buffer that is then stretched to the canvas, so the per-pixel iteration stays fast at fullscreen; Pixel size sets that reduction.

Newton's method, Cayley's problem and basins

Newton's method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm that produces successively better approximations to the roots of a function. Given a guess, you replace it by a better one using the function and its derivative, and repeat. If the derivative at the root is nonzero and the guess is close, convergence is at least quadratic, which is why the method remains one of the most widely taught in numerical analysis.

The picture changes when the guess is allowed to be a complex number. In 1879 Arthur Cayley was the first to notice the difficulties in extending the method to complex starting values for polynomials of degree greater than 2, which opened the way to the study of the iteration of rational functions. The Newton fractal is the Julia set of the function z - p(z)/p'(z): it divides the plane into regions, one for each root, and the boundary between them is intricate at every scale.

The pattern matters in practice because it shows that, outside the region of quadratic convergence, Newton's method can be very sensitive to its choice of starting point. Colour here records which root a pixel's start leads to, and shading tracks how many steps that took, so the darker bands mark the slow regions near the boundaries.

A worked example

At the defaults — degree 3, Spectrum palette, Pixel size 3 — three basins in red, green and blue divide the screen, and where any two meet, the third appears as a chain of ever-smaller blobs, each of which has the other two inside it again. Raise the degree to 5 and five colours share the plane with the same nesting along every border. Watch the wandering root pull its basin across the others like a lens.

Settings & tips

Frequently asked questions

Why are the boundaries fractal?
Near a boundary a tiny change in the starting point changes which root Newton’s method finds, and that sensitivity repeats at every magnification. Wherever two basins meet, the remaining basins also appear, so the border is infinitely detailed.
Is the polynomial real?
Yes — it is the polynomial whose roots are the moving points on screen, p(z) = ∏(z − rₖ). The colours are literally which root the method converges to from each pixel.
Will this slow my computer down?
It is tuned to run smoothly on an ordinary laptop. If it feels heavy, raise the Pixel size or lower the speed in the settings; every control takes effect immediately.
Is the Newton Fractal screensaver free?
Yes. It runs free in your browser with nothing to download or install, and it keeps working offline once the page has loaded.
How do I exit the Newton Fractal screensaver?
Press the ESC key at any time to leave fullscreen and return to the page.
What is a basin of attraction?
The set of starting points that all lead to the same final result, here the same root of the polynomial.
Who first noticed the difficulty with Newton's method in the complex plane?
Arthur Cayley, in 1879. He found that extending the method to complex starting values was problematic for polynomials of degree greater than 2, which led to the study of iterating rational functions.
Does the method always converge?
No. It is guaranteed to home in quickly only when the guess is close enough to a root, and from other starting points it can be very sensitive to where it starts.

← All Generative screensavers