# Newton fractal

The Newton fractal is a boundary set in the complex plane which is characterized by Newton's method applied to a fixed polynomial p(z) ∈ $\mathbb {C}$[z] or transcendental function. It is the Julia set of the meromorphic function z ↦ z − ⁠p(z)/p′(z)⁠ 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 G$_k$, each of which is associated with a root ζ$_k$ of the polynomial, k = 1, …, 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.
Almost all points of the complex plane are associated with one of the deg(p) roots of a given polynomial in the following way: the point is used as starting value z$_0$ for Newton's iteration z$_{n+1}$ := z$_n$ − ⁠p(z$_n$)/p'(z$_n$)⁠, yielding a sequence of points z$_1$, z$_2$, …, If the sequence converges to the root ζ$_k$, then z$_0$ was an element of the region G$_k$. 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 z$^3$ − 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 images of the fractal, one may first choose a specified number d of complex points (ζ$_1$, …, ζ$_d$) and compute the coefficients (p$_1$, …, p$_d$) of the polynomial
    $p(z)=z^{d}+p_{1}z^{d-1}+\cdots +p_{d-1}z+p_{d}:=(z-\zeta _{1})(z-\zeta _{2})\cdots (z-\zeta _{d})$.
Then for a rectangular lattice
    $z_{mn}=z_{00}+m\,\Delta x+in\,\Delta y;\quad m=0,\ldots ,M-1;\quad n=0,\ldots ,N-1$
of points in $\mathbb {C}$, one finds the index k(m,n) of the corresponding root ζ$_{k(m,n)}$ and uses this to fill an M × N raster grid by assigning to each point (m,n) a color f$_{k(m,n)}$. Additionally or alternatively the colors may be dependent on the distance D(m,n), which is defined to be the first value D such that |z$_D$ − ζ$_{k(m,n)}$| < ε for some previously fixed small ε > 0.

## Generalization of Newton fractals

A generalization of Newton's iteration is
    $z_{n+1}=z_{n}-a{\frac {p(z_{n})}{p'(z_{n})}}$
where a is any complex number. The special choice a = 1 corresponds to the Newton fractal.
The fixed points of this map are stable when a lies inside the disk of radius 1 centered at 1. When 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 p is a polynomial of degree d, then the sequence z$_n$ is bounded provided that a is inside a disk of radius d centered at d.
More generally, Newton's fractal is a special case of a Julia set.
* Newton fractal for three degree-3 roots p(z) = z$^3$ − 1, coloured by number of iterations required
* Newton fractal for three degree-3 roots p(z) = z$^3$ − 1, coloured by root reached
* Newton fractal for p(z) = z$^3$ − 2z + 2. Points in the red basins do not reach a root.
* Newton fractal for a 7th order polynomial, colored by root reached and shaded by rate of convergence.
* Newton fractal for p(z) = z$^8$ + 15z$^4$ − 16
* Newton fractal for p(z) = z$^5$ − 3iz$^3$ − (5 + 2i)z$^2$ + 3z + 1, coloured by root reached, shaded by number of iterations required.
* Newton fractal for p(z) = sin z, coloured by root reached, shaded by number of iterations required
* Another Newton fractal for p(z) = sin z
* Generalized Newton fractal for p(z) = z$^3$ − 1, a = −⁠1/2⁠. The colour was chosen based on the argument after 40 iterations.
* Generalized Newton fractal for p(z) = z$^2$ − 1, a = 1 + i.
* Generalized Newton fractal for p(z) = z$^3$ − 1, a = 2.
* Generalized Newton fractal for p(z) = z$^{4+3i}$ − 1, a = 2.1.
* p(z) = z$^6$ + z$^3$ - 1
* p(z) = sin z - 1
* p(z) = sin z - 1
* p(z) = cosh z - 1
* p(z) = cosh z - 1
* p(z) = z$^{20}$ - 2z + 2
Serie : p(z) = z$^n$- 1
* p(z) = z$^3$ - 1, a=1
* p(z) = z$^3$ - 1, a=2
* p(z) = z$^4$ - 1, a=1
* p(z) = z$^4$ - 1, a=2
* p(z) = z$^5$ - 1, a=1
* p(z) = z$^5$ - 1, a=2
* p(z) = z$^6$ - 1, a=1
* p(z) = z$^7$ - 1, a=1
* p(z) = z$^8$ - 1, a=1
* p(z) = z$^{10}$ - 1, a=1
Other fractals where potential and trigonometric functions are multiplied. p(z) = z$^n$*Sin(z) - 1
* p(z) = z$^2$*Sin(Z) - 1, a=1
* p(z) = z$^2$*Sin(Z) - 1, a=1 (zoom)
* p(z) = z$^3$*Sin(Z) - 1, a=1
* p(z) = z$^4$*Sin(Z) - 1, a=1
* p(z) = z$^4$*Sin(Z) - 1, a=1 (zoom)
* p(z) = z$^5$*Sin(Z) - 1, a=1
* p(z) = z$^6$*Sin(Z) - 1, a=1
* p(z) = z$^6$*Sin(Z) - 1, a=1 (zoom)

### Nova fractal

The Nova fractal invented in the mid 1990s by Paul Derbyshire, is a generalization of the Newton fractal with the addition of a value c at each step:
    $z_{n+1}=z_{n}-a{\frac {p(z_{n})}{p'(z_{n})}}+c=G(a,c,z)$
The "Julia" variant of the Nova fractal keeps c constant over the image and initializes z$_0$ to the pixel coordinates. The "Mandelbrot" variant of the Nova fractal initializes c to the pixel coordinates and sets z$_0$ to a critical point, where
    ${\frac {\partial }{\partial z}}G(a,c,z)=0.$
Commonly-used polynomials like p(z) = z$^3$ − 1 or p(z) = (z − 1)$^3$ lead to a critical point at z = 1.
* Animated "Julia" Nova fractal for p(z) = z$^3$ − 1 with c going from −1 to 1, colored by root reached.
* Animated "Julia" Nova fractal for p(z) = z$^3$ − 1 with c = ⁠1/2⁠e$^{iφ}$ and φ going from 0 to 2π, colored by root reached.

## Implementation

In order to implement the Newton fractal, it is necessary to have a starting function as well as its derivative function:
    ${\begin{aligned}f(z)&=z^{3}-1\\f'(z)&=3z^{2}\end{aligned}}$
The three roots of the function are
    $z=1,\ -{\tfrac {1}{2}}+{\tfrac {\sqrt {3}}{2}}i,\ -{\tfrac {1}{2}}-{\tfrac {\sqrt {3}}{2}}i$
The above-defined functions can be translated in pseudocode as follows:
It is now just a matter of implementing the Newton method using the given functions.