Most of the images on this site are fractals. Although the formal definition of fractal is up for debate, fractal images are generally formed by computing a mathematical function, sometimes called the "recurrence" function or relation, repeatedly and using the results of this function to define different colors in the image.

The most famous fractal is the Mandelbrot Set. It uses the recurrence function \(z_{n+1} = z_n^2 + z_0\). The variable \(z\) represents the coordinates of every pixel in the image. In the classic Mandelbrot set, the recurrence equation is computed many times until the value of \(z_n\) either becomes large (usually greater than 2), or the number of iterations exceeds some threshod. If the iteration threshod is reached, the pixel is colored black. Otherwise, a color is chosen based on how many iterations it took the pixel to "escape" to a large value. This method of coloring results in the typical Mandelbrot set fractals.

Orbit Traps

Using the number of iterations required for a pixel to escape is just one method for coloring a fractal. Another method is to use "orbit traps". In this method, a region of the image, called a "trap", is defined. As the value of \(z\) changes ("orbits") before escaping, if the point lands within the trap, the pixel will be filled with a color dependent on how far the point falls to the center of that trap. For example, the same recurrence relationship \(z_{n+1} = z_n^2 + z_0\), but drawn with an orbit trap along the y-axis, results in this image.

The fractal images on this site just extend these ideas to other recurrence functions and orbit trap types. The art is in choosing a recurrence function along with defining one or more carefully selected orbit traps, and adding a color palette, to produce aesthetically interesting results.

Mathematical Artwork in Python E-Book

Far more details regarding the math, how it can be implemented in Python code, and how the math can be used to influence design of an image, are available in Mathematical Artwork in Python, a 206-page PDF e-book detailing the creation of images such as the ones on this page. The book includes source code examples for many images, all in simple Python, relying only on the common Numpy, Pillow, and Matplotlib libraries. The book intends to bridge the gap between math, code, and design. See more details and purchase the book from my store using the button below.

Buy the Book