Complex Domain Coloring

 

Complex Domain Coloring was introduced to me by Jan Hlavacek as a way of visualizing a function of a complex variable by associating a complex number with a color. The basic idea is to express the color in its HSV representation, where the phase of the complex number determines the color's hue, and the modulus of the complex number gives the color's saturation and value.

With built-in support for complex numbers and an easy to use PNG module, S-Lang is ideally suited for this sort of task. In fact, the background image that you see on this page was created through this technique using the function:

f(z) = \big[z + \frac{z^2}{\sin(z^4-1)}\big]^2

To facilitate the creation of such images, I wrote a S-Lang script called fztopng that converts a user-specified function of a complex number to a PNG image. For information about obtaining fztopng and more details about its use, see its page.

The function

f(z) = \frac{\cos(z)}{\sin(z^4-1)}

will be used to illustrate some of the capabilities of the fztopng. Here is what it shows the function to look like using the default coloring scheme:

demo0.png

fztopng also supports a coloring algorthm based solely upon the phase of the complex number. The phase is then used to linearly interpolate between two specified colors. Here is what the function looks like when colored using this algorithm:

demo0grad.png

Very interesting pictures result when functions are iterated. For example, the first iteration of f(z) is

f_1(z) = f(f(z)),

which produces:

demo1.png

The first iteration colored with the phase-only algorithm looks a bit like a coat-of-arms:

demo1grad.png

And the 10th iteration of f(z) resembles an Oriental rug:

demo10.png
Now whenever I see such rugs I wonder if there is some complex function that will produce such a pattern!

This page was last updated Nov 26, 2017 by John E. Davis. To comment on it or the material presented here, send email to jed at jedsoft org.
Valid HTML 4.01! Made with JED Viewable With Any Browser