**Example 13. Colorizing a Fractal with a One Dimensional Fractal**

The implementation of the methods described in this example begin with the classical and highly recognizable plot of the Mandelbrot "Flying Turtle", shown in image 13.1. We begin with code that is algorithmically identical to examples shown at mathworld.wolfram.com/MandelbrotSet.html and www.bugman123.com/Fractals/Fractals.htm . We suggest that you read the first of those two references for definitions of the complex plane and its variables that are duplicated here to produce Image 13.1. The second of those two references includes very concise and fast Mathematica code for generating the Flying Turtle fractal. Our code is much more verbose so as to provide access to parameters that are not ordinarily used in drawing a fractal.

Following Image 13.1, there is an implementation of a depth and texture gauge for the inner coastline of the fractal. That gauge is quantitative, and it can be used to self-color the fractal via a pseudocolor scheme based on the depth and texture of the fractal itself. Each of those images includes a description of the parameters and code that we have used for this self-colorization. For the student or researcher studying fractals, there is much more to be done. This includes changing our code to look at the depth and texture of the fractal from the outside and changing parameters that generate the colorbar. Fractal-based colorbars could be used to colorize non-fractal images. That is a suggestion for further work and study.

Image 13.1. Mandelbrot set of the Flying Turtle, in grayscale.

Image 13.1 has 256 x 256 pixels, and it was generated over the typical initial values and ranges for the turtle. The range complex range is -2.0 to 1.0, -1.5 to 1.5, with 100 iterations. Escape to infinity is detected by requiring that the recursion of the complex value of z does not exceed an absolute value of 2. These parameters are identical to the ones given in the hyperlinks, above. The results are identical, with the exception that our Mathematica code transposes the figure by a 90 degree rotation. In our code, numbers related to the fractal's generation are sometimes scaled 0-256 so that indexing can be performed.

Image 13.2 Flying Turtle Fractal colorized by a pseudocolor "depth and texture" gauge.

To generate Image 13.2, we proceeded by probing the right wall of the fractal from inside the fractal, beginning at a center line running from the top to the bottom. From this center line, each row was scanned to the right for non-zero grayscale values. R, G, B values in the image represent pixels that fall within certain grayscale ranges as specified by the fractals grayscale (0-1):

Red indicates a grayscale value of between 0.6 - 1.0;

Green indicates a grayscale value of between 0.3 - 0.5;

Blue indicates a grayscale value of between 0.12 - 0.15 .

These ranges are arbitrary and involved trial and error observation by the programmer to obtain an "interesting" image. Suggestions for further work include the development of more defined criteria to set the grayscale ranges.

Image 13.3. This image is identical to Image 13.2, except all white pixels were redrawn as black.

Image 13.4. This image is a zoomed region Image 13.3.

Image 13.5. One-dimensional representation of the of the Flying Turtle's inner coastline.

The color bar in Image 13.5 can be aligned to the side of Images 13.2 and 13.3 to see how it was constructed. For those colorized representations, the right-most R, G, and B pixels were combined into one RGB value that is displayed from top to bottom in the color bar in exact registration with the colorized fractal. As noted above, these values are determined by the R, G, and B ranges that were, in turn, based on the first image's monochrome grayscale values. Changing those ranges has a direct effect on this colorbar. Again, these setting were somewhat arbitrary, and it is suggested for future work that a more specific criterion for these ranges be developed.

Image 13.6. Colorization of the grayscale Flying Turtle by its own texture and depth.

In Image 13.6, we have used the monochrome values of Image 13.1 to index into the colorbar of Image 13.5. This pseudocoloring scheme blackens all pixels in the lower and upper grayscale ranges of the Flying Turtle.

Image 13.7. Zoomed region of Image 13.6.

Source code for this example is linked here in .nb and PDF formats.