Generating the Images

The source code for this project can be found at my GitHub: https://github.com/SSODelta/PolynomialVisualizer

There are many ways of visualizing numbers in the complex plane, as seen in my previous post on Newton’s Fractals. This post will detail another method of getting pretty pictures from equations.

The basic idea of this method is to visualize where each complex number is mapped to by some polynomial. The color will depend on the direction the complex number goes after having been through the polynomial, and the distance it travels. Alright, let’s get formal!

Like the post on Newton’s Fractals we start off with a polynomial of some degree. Call this .

To generate a fractal, we first need to specify how large the image we need to make is, call this , where is the width in pixels, and is the height (also in pixels). Next up, we have to specify which numbers we’ll use, so we decide on a resolution – we’ll only consider complex numbers , where .

Now, we’ll iterate over every single pixel in the image. Then, the associated complex number will be . To make it more clear why this is the case, take a look at the real and imaginary parts individually:

Re :

: Im:

Anyway, we now have a complex number . Now, we’ll calculate , where was the polynomial we chose. Next up, we’ll construct a vector .

From this vector, we’ll calculate the angle between a vector pointing to the right of the screen – this is the just the function of the vector. So, we get an angle .

For the next part, we’ll start by calculating a value , and two values , and .

We’ll treat these three values , , and as the three color components of the HSV-color type. We’ll now use the same conversion process as described in my post on psychedelic animations to convert HSV to RGB.

Then we’ll paint the pixel at with the color information.

If we do this process for all pixels, we get impressive images:

To see an album with 78 of these images, check out my Imgur-album here: http://imgur.com/a/Ii5VM

Analyzing the images

One of the first things I noticed with these images is obviously the yellow shape in the middle of the layers of circles. What I think is interesting is that if we project the yellow pixels in the central shape over the central x-axis of the image, they don’t encounter another yellow pixel.

Said in another way, if you cut the image horizontally and overlay the two halves, the yellow pixels in the central shape don’t touch. They are disjoint, in other words.

We can also specify this (somewhat) formally. If a pixel is yellow (and in the entral blob), then won’t be yellow.

The sad thing is that I don’t have the slightest clue why this happens. If someone smarter than I knows why the images look like they do, feel free to use the comment section down below to enlighten me!

Making the images even cooler

If we have an image of size (the images we’ve generated), we construct a new image of size . And for each pixel in , we paint it with color , where represents the color information in image at position .

My original idea was that this would make it evident that the yellow parts are disjoint when reflected over the central x axis, but it turns out it doesn’t.

Original Image :

Processed Image :

Clearly, this does not convey much information about the central yellow blobs, but it looks really, really cool.

Here are some more images that have been processed:

Original Image :

Processed Image :

Original Image :

Processed Image :

Unfortunately, I don’t have an album with lots of processed images, but if you want you can try running the code yourself.