# Newton fractal

Julia set for the rational function associated to Newton's method for ƒ:z→z3−1.

The Newton fractal is a boundary set in the complex plane which is characterized by Newton's method applied to a fixed polynomial ${\displaystyle p(Z)\in \mathbb [Z]}$ or transcendental function. It is the Julia set of the meromorphic function ${\displaystyle z\mapsto z-{\tfrac }}$ which is given by Newton's method. When there are no attractive cycles (of order greater than 1), it divides the complex plane into regions ${\displaystyle G_}$, each of which is associated with a root ${\displaystyle \zeta _}$ of the polynomial, ${\displaystyle k=1,\ldots ,\deg(p)}$. In this way the Newton fractal is similar to the Mandelbrot set, and like other fractals it exhibits an intricate appearance arising from a simple description. It is relevant to numerical analysis because it shows that (outside the region of quadratic convergence) the Newton method can be very sensitive to its choice of start point.

Many points of the complex plane are associated with one of the ${\displaystyle \deg(p)}$ roots of the polynomial in the following way: the point is used as starting value ${\displaystyle z_}$ for Newton's iteration ${\displaystyle z_:=z_-{\frac )})}}}$, yielding a sequence of points ${\displaystyle z_,z_,\ldots ,}$ If the sequence converges to the root ${\displaystyle \zeta _}$, then ${\displaystyle z_}$ was an element of the region ${\displaystyle G_}$. However, for every polynomial of degree at least 2 there are points for which the Newton iteration does not converge to any root: examples are the boundaries of the basins of attraction of the various roots. There are even polynomials for which open sets of starting points fail to converge to any root: a simple example is ${\displaystyle z^-2z+2}$, where some points are attracted by the cycle 0, 1, 0, 1 ... rather than by a root.

An open set for which the iterations converge towards a given root or cycle (that is not a fixed point), is a Fatou set for the iteration. The complementary set to the union of all these, is the Julia set. The Fatou sets have common boundary, namely the Julia set. Therefore, each point of the Julia set is a point of accumulation for each of the Fatou sets. It is this property that causes the fractal structure of the Julia set (when the degree of the polynomial is larger than 2).

To plot interesting pictures, one may first choose a specified number ${\displaystyle d}$ of complex points ${\displaystyle (\zeta _,\ldots ,\zeta _)}$ and compute the coefficients ${\displaystyle (p_,\ldots ,p_)}$ of the polynomial

${\displaystyle p(z)=z^+p_z^+\cdots +p_z+p_:=(z-\zeta _)\cdot \cdots \cdot (z-\zeta _)}$.

Then for a rectangular lattice ${\displaystyle z_=z_+m\,\Delta x+in\,\Delta y}$, ${\displaystyle m=0,\ldots ,M-1}$, ${\displaystyle n=0,\ldots ,N-1}$ of points in ${\displaystyle \mathbb }$, one finds the index ${\displaystyle k(m,n)}$ of the corresponding root ${\displaystyle \zeta _}$ and uses this to fill an ${\displaystyle M}$×${\displaystyle N}$ raster grid by assigning to each point ${\displaystyle (m,n)}$ a color ${\displaystyle f_}$. Additionally or alternatively the colors may be dependent on the distance ${\displaystyle D(m,n)}$, which is defined to be the first value ${\displaystyle D}$ such that ${\displaystyle |z_-\zeta _|<\epsilon }$ for some previously fixed small ${\displaystyle \epsilon >0}$.

## Generalization of Newton fractals

A generalization of Newton's iteration is

${\displaystyle z_=z_-a{\frac )})}}}$

where ${\displaystyle a}$ is any complex number.[1] The special choice ${\displaystyle a=1}$ corresponds to the Newton fractal. The fixed points of this map are stable when ${\displaystyle a}$ lies inside the disk of radius 1 centered at 1. When ${\displaystyle a}$ is outside this disk, the fixed points are locally unstable, however the map still exhibits a fractal structure in the sense of Julia set. If ${\displaystyle p}$ is a polynomial of degree ${\displaystyle d}$, then the sequence ${\displaystyle z_}$ is bounded provided that ${\displaystyle a}$ is inside a disk of radius ${\displaystyle d}$ centered at ${\displaystyle d}$.

More generally, Newton's fractal is a special case of a Julia set.

### Nova fractal

The Nova fractal invented in the mid 1990s by Paul Derbyshire,[2][3] is a generalization of the Newton fractal with the addition of a value ${\displaystyle c}$ at each step:[4]

${\displaystyle z_=z_-a{\frac )})}}+c=G(a,c,z)}$

The "Julia" variant of the Nova fractal keeps ${\displaystyle c}$ constant over the image and initializes ${\displaystyle z_}$ to the pixel coordinates. The "Mandelbrot" variant of the Nova fractal initializes ${\displaystyle c}$ to the pixel coordinates and sets ${\displaystyle z_}$ to a critical point, where ${\displaystyle {\frac {\partial }{\partial z}}G(a,c,z)=0}$.[5] Commonly-used polynomials like ${\displaystyle p(z)=z^-1}$ or ${\displaystyle p(z)=(z-1)^}$ lead to a critical point at ${\displaystyle z=1}$.

## Implementation

In order to implement the Newton Fractal, it is necessary to have a starting function as well as its derivative function:

${\displaystyle f(z)=z^-1}$
${\displaystyle f'(z)=3z^}$

The roots of the function are

${\displaystyle z=1,-0.5\pm {\sqrt }/2i}$

The above-defined functions can be translated in pseudocode as follows:

//z^3-1  float2 Function (float2 z) { return cpow(z, 3) - float2(1, 0); //cpow is an exponential function for complex numbers } //3*z^2 float2 Derivative (float2 z) { return 3 * cmul(z, z); //cmul is a function that handles multiplication of complex numbers }

It is now just a matter of implementing the Newton method using the given functions.

For each pixel (x, y) on the target, do: { zx = scaled x coordinate of pixel (scaled to lie in the Mandelbrot X scale (-2.5, 1)) zy = scaled y coordinate of pixel (scaled to lie in the Mandelbrot Y scale (-1, 1)) float2 z = float2(zx, zy); //Z is originally set to the pixel coordinates float2 roots[3] = //Roots (solutions) of the polynomial { float2(1, 0), float2(-.5, sqrt(3)/2), float2(-.5, -sqrt(3)/2) }; color colors[3] = //Assign a color for each root { red, green, blue } for (int iteration = 0; iteration < maxIteration; iteration++;) { z -= cdiv(Function(z), Derivative(z)); //cdiv is a function for dividing complex numbers float tolerance = 0.000001; for (int i = 0; i < roots.Length; i++) { float difference = z - roots[i]; //If the current iteration is close enough to a root, color the pixel. if (abs(difference.x) < tolerance && abs(difference.y) < tolerance) { return colors[i]; //Return the color corresponding to the root } } } return black; //If no solution is found }