Newton fractals

Newton fractals

December 20, 2020

Another interesting set of fractals, are Newton fractals. Newton fractals are created by applying Newton's method to complex function $f(z)$. The method uses the iterated equation $$ z_{n+1} = z - \frac{f(z_n)}{f'(z_n)}. $$ If we want to apply Newton's method, we also need to find the derivative of the function $f(z)$. Since Newton's method is used to find the zero's of a function, if we repeatedly apply it to a point $z$, then $f(z_{n\rightarrow\infty}) = 0$, meaning that every point converges to a root of the complex function. Although the points usually converge to a root, it is also possible that is orbit cyclic.

Suppose we have the function $f(z) = z^3 - 1$, then the derivative is $f'(z) = 3z^2$. This function has three roots. If we apply Newton's method for all the points in the plane $[-1, 1]\times[-1, 1]$, then each of these points will end up at one of those three roots. We can then visualize the result by giving the resulting pixel value a color based on the root it ended up at. In this case the color is determined by looking at the angle of the root, and then get a color from a color map. The color map used in this example is hsv2rgb(angle + 0.1, 1, 1).

Plot of the argument of $f : z \rightarrow z^3-1$.

It took a few attempts to get this image. The silliest mistake I made was using a function that has only 1, or 2 roots. This simply results in an image with only one, or two colors.

Relaxed Newton's method

It is possible to modify the method by multiplying with a relaxation parameter $R$. This real number is used to increase/decrease the step size. The relaxed Newton's method is $$ z_{n+1} = z_n - R\cdot\frac{f(z_n)}{f'(z_n)}. $$ If we then let the value of R animate between $[0.2, 2.2]$, we can see what the effect of this relaxation parameter is. Press play in the shader below, to see the animation.

Generalized Newton's method

Another thing that can be done is to generalize the method by it multiplying with a complex number $a$, instead of using the real relaxation parameter: $$ z_{n+1} = z_n - a\cdot\frac{f(z_n)}{f'(z_n)}. $$ If we then let $\Re(z)$ and $\Im(z)$ animate between the values $[-1, 1]$, in this case with a Lissajous curve, we can see the effect $a$ has on the method. Press play in the shader below to see the animation.

Using a different color map

Instead of using the HSV color map, which gives us a rainbow based on the angle of the complex number, we are going to look at the magnitude of the complex number, which is $|z|$. We will also use the magma color map from matplotlib, which is created by Mattz and available on ShaderToy. I have slightly modified the color map, because I wanted it to wrap at the edges, instead of having a discontinuity.

Because we want to loop our color map, we will only use the fractional part of $|z|$. The following image is the Newton fractals rendered with the color map.

Plot of the argument of $f : z \rightarrow z^3 - 1$ with $a=(0.04352, 0.300609)$.

© 2022 Lars Rotgers
All rights reserved