2

This is a seemingly difficult question I think. I am (or at least will be) writing a dissertation of Fractal Geometry which is to be submitted electronically. For obvious reasons, I will be hoping to include an illustration of the Mandelbrot Fractal.

There are answers available for a 'simple' image of the fractal but I was hoping there would be a way to animate this image to zoom in (in theory endlessly) – a little like this

https://www.youtube.com/watch?v=zXTpASSd9xE

but not as detailed. Does anybody know how to do this?

My preamble is currently empty so I full list of necessary packages would be great. Thank you in advance.

4

1 Answer 1

5

If you really want to burn your rader's/reviewer's CPU, here you are:

\documentclass[tikz]{standalone}

\def\pspreparation#1#2#3{
    20 div exch 20 div % y x
    #3 div exch #3 div % x y
    #2 add exch #1 add 2 copy true % y x y x true
}
\def\psiteration{ % y x Y X in?
    {dup dup mul 2 index dup mul sub 3 index sub 3 1 roll 2 mul mul 3 index sub exch 2 copy dup mul exch dup mul add 3 le}{false}ifelse
}
\def\psdecoration{
    5 1 roll pop pop pop pop % in?
    {0 0 0}{1 1 1}ifelse % R G B
}
\def\pgfdeclaremandelbrot#1#2#3{
    \pgfdeclarefunctionalshading{Mandelbrot(#1,#2,#3)}{\pgfpoint{-25bp}{-25bp}}{\pgfpoint{25bp}{25bp}}{}{
        \pspreparation{#1}{#2}{#3}
        \psiteration\psiteration\psiteration\psiteration\psiteration\psiteration\psiteration\psiteration
        \psiteration\psiteration\psiteration\psiteration\psiteration\psiteration\psiteration\psiteration
        \psdecoration
    }
}
\def\pgfprintmandelbrot#1#2#3{
    \pgfdeclaremandelbrot{#1}{#2}{#3}
    \tikz\path[shading={Mandelbrot(#1,#2,#3)}](-10,-10)rectangle(10,10);
}

\begin{document}
    % x-shift, y-shift, scale
    \pgfprintmandelbrot{ .6}{ 0}{1}
    \pgfprintmandelbrot{ .4}{ 0}{1.2}
    \pgfprintmandelbrot{ .2}{ 0}{1.44}
    \pgfprintmandelbrot{ .0}{ 0}{1.728}
    \pgfprintmandelbrot{-.2}{ 0}{2.0736}
    \pgfprintmandelbrot{-.4}{ 0}{2.48832}
    \pgfprintmandelbrot{-.4}{.1}{2.985984}
    \pgfprintmandelbrot{-.4}{.2}{3.5831808}
    \pgfprintmandelbrot{-.4}{.3}{4.29981696}
    \pgfprintmandelbrot{-.4}{.4}{5.159780352}
\end{document}

GIF version: (Due to the ImageMagick fails to convert PDF files containing functional shading, it is going to be glitchy)

Fixed GIF version (using Preview on Mac)

4
  • That... is... amazing! You are a genius! Thank you.
    – PercyF2519
    Commented Mar 12, 2017 at 20:15
  • It seems like my plot heading the opposite direction. That is in fact my prefered direction. See my profile picture. (Yes, it is done by TeX.)
    – Symbol 1
    Commented Mar 12, 2017 at 20:22
  • Why is it your favourite direction? I suppose it makes no real difference for visual displays.
    – PercyF2519
    Commented Mar 12, 2017 at 20:24
  • @PercyF2519 Because it makes me unique! But computationally, as you said, I am not :(
    – Symbol 1
    Commented Mar 12, 2017 at 20:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .