<p>An animated diagram showing iterations of the equation used to generate the <a href="https://en.wikipedia.org/wiki/Mandelbrot_set" class="extiw" title="w:Mandelbrot set">Mandelbrot set</a>, a <a href="https://en.wikipedia.org/wiki/Fractals" class="extiw" title="w:Fractals">fractal</a> first studied by <a href="https://en.wikipedia.org/wiki/Beno%C3%AEt_Mandelbrot" class="extiw" title="w:Benoît Mandelbrot">Benoît Mandelbrot</a> in 1979.
The animation shows the values of <i>Z</i> for first 20 iterations of the equation 
</p>
<dl><dd><dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle Z_{n+1}=Z_{n}^{2}+c,\,}"><semantics><mrow class="MJX-TeXAtom-ORD"><mstyle displaystyle="true" scriptlevel="0"><msub><mi>Z</mi><mrow class="MJX-TeXAtom-ORD"><mi>n</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><msubsup><mi>Z</mi><mrow class="MJX-TeXAtom-ORD"><mi>n</mi></mrow><mrow class="MJX-TeXAtom-ORD"><mn>2</mn></mrow></msubsup><mo>+</mo><mi>c</mi><mo>,</mo><mspace width="thinmathspace"></mspace></mstyle></mrow><annotation encoding="application/x-tex">{\displaystyle Z_{n+1}=Z_{n}^{2}+c,\,}</annotation></semantics></math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/9ca9680eac6fab9020a3af596202a80ed8987a4f" class="mwe-math-fallback-image-inline" aria-hidden="true" style="vertical-align: -0.671ex; width:15.692ex; height:2.843ex;" alt="{\displaystyle Z_{n+1}=Z_{n}^{2}+c,\,}"></span></dd></dl></dd></dl><p>where <i>c</i> is a <a href="https://en.wikipedia.org/wiki/Complex_number" class="extiw" title="w:Complex number">complex</a> variable.
</p><p>Mandelbrot set graphics are usually generated using the so-called "escape algorithm", where color is assigned according to the number of iterations it took for the equation to diverge past a pre-set limit, and black color is used for regions that never diverge. This, however,  is a plot of a much simpler quantity: the actual values of the equation at the first 20 iterations. Every pixel in the image corresponds to a different value of a complex constant <i>c</i> ranging from <i>-2.2</i> to <i>1</i> on the real axis (horizontal) and from <i>-1.2i</i> to <i>1.2i</i> on the imaginary axis (vertical). <i>Z</i> is initialized to 0. At each iteration, the next value of <i>Z</i> is calculated using the equation above.
</p>
This graphic was generated with 13 lines of code in the <a href="https://en.wikipedia.org/wiki/en:R_(programming_language)" class="extiw" title="w:en:R (programming language)">R language</a> (see below for the code). For each point, the magnitude (aka absolute value) of <i>Z</i> is calculated, than scaled using an exponential function to emphasize fine detail, and finally mapped to color palette (<i>jetColors</i>). Dark red is a very low number, dark blue is a very high number. The deep blue region "squeezing" in the boundaries of the fractal is the region where <i>Z</i> value diverges to infinity.
<a href="//commons.wikimedia.org/wiki/User:Jarekt" title="User:Jarekt">Jarekt</a>
CC BY-SA 4.0
<span class="int-own-work" lang="en">Own work</span>