Archive for the ‘fractals’ Category

Getting rid of the branch cut

Monday, September 15th, 2008

The video I made for Saturday’s post made me wonder what the picture would look like if you didn’t have a branch cut at all - if you make the logarithm function generate all of its multiple values (or equivalently, choose a sheet of the Riemann surface at random). Computers can’t count up to infinity so the random method must be used. We can’t make all the sheets equally likely as their number is unbounded so we need to pick some distribution. I chose a method that’s rather simple to implement - I just roll a (virtual) dice until a 1 or a 6 comes up, and subtract the number of 2s and 3s from the number of 4s and 5s (a 1D random walk). That makes positive and negative numbers equally likely, but makes small (positive or negative) numbers more likely than large ones.

Here is the result:

Square roots

The infinite tower is transformed into a fractal fern-like structure. I was surprised at how different this looked from the second image on this post - while the non-principal branches are not visited very often, they cover a lot of space so make a lot of difference to the image.

Adjusting the branch cut

Saturday, September 13th, 2008

The second image in this post was quite popular, so I decided to make a movie out of it.

There aren’t really many parameters in the equations used to make this image, though - (the functions are just negative, exponential and logarithm). The colouring is arbitrary but modifying it wouldn’t make a very interesting movie. The zoom factor is fairly arbitrary as well but zooming very much in or out would make the image take much longer to render (besides which, zooming movies have been done to death). About the only other arbitrary thing about the image is the choice of branch cut for the logarithm.

This describes a way of adjusting the branch cut in a continuous way, and this is the movie I made by adjusting theta from -4.5 to +4.5 radians:

High quality 640×480 11Mb DivX avi version.

This took about three days to render. I could have done it faster, but my laptop gets uncomfortably warm when both its cores are fully utilized. Also, a problem with Vista networking was causing the other machine I was using to keep getting disconnected from my laptop every few frames.

Triangular lattices

Monday, September 8th, 2008

A commenter wondered what the images on Saturday’s post would look like using a sixth root of unity instead of a fourth. I am happy to oblige. With ω=eπi/3, this is the image with the operations z+ω, ωz, ωz:

w^z

And this is the image with the operations z+ω, ωz, zω:

z^w

Powers involving i

Saturday, September 6th, 2008

More variations:

Red: z->z+i
Green: z->iz
Blue: z->iz:

i^z

Same, but with blue: z->zi:

z^i

Reslicing

Friday, September 5th, 2008

A movie can be thought of as a three-dimensional array of pixels - horizontal, vertical and time. If you have such a three-dimensional array of pixels, there are three different ways of turning it into a movie - three different dimensions that you can pick as “time”. For movies of real things this probably isn’t a very interesting thing to do, but for movies of mathematical objects like the one I made yesterday, there may be mathematical insights to be gained from “reslicing” a movie.

So, here is yesterday’s movie with the x and time coordinates swapped:

Higher resolution version (8Mb 640×480 DivX).

And here it is with the y and time coordinates swapped (and also rotated to landscape format):

Higher resolution version (8Mb 640×480 DivX).

I made a movie

Thursday, September 4th, 2008

Higher quality 10Mb 640×480 DivX version here.

This is a generalization of the second picture from yesterday’s post, varying the coefficient of i from e-4.5 to e4.5. It also demonstrates how this picture is related to the third picture from Monday’s post.

1.35 trillion points were calculated to make this movie, taking 4 CPUs with 6 cores most of a day (it was going to take nearly 4 days, but I decided to use most of the other computers in the house as a render farm).

Two more

Wednesday, September 3rd, 2008

Square roots

Generated by a program similar to the last two pictures on Monday’s post, but the functions are +sqrt(z), -sqrt(z) and 1+z. Don’t plot a point if the last operation was 1+z, and colour points according to the operation used 5 iterations ago.

Golden ratio

Similar to the third image on Monday’s post, but when we multiply by i we also multiply by the golden ratio (1+sqrt(5))/2 = 1.618… Most the rectangles you see in this image are golden rectangles, which are supposedly the most aesthetically pleasing.

Fourier transform of the Mandelbrot set

Sunday, August 31st, 2008

I wonder what the Fourier transform of the Mandelbrot set looks like? More specifically, the 2D Fourier transform of the function f(x,y) = {0 if x+iy is in M, 1 otherwise}. This has infinitely fine features, so the Fourier transform will extend out infinitely far from the origin. It’s aperiodic, so the Fourier transform will be non-discrete.

The result will be a complex-valued function of complex numbers (since each point in the frequency domain has a phase and amplitude). That raises the question of its analytical properties - is it analytic everywhere, in some places or nowhere? (Probably nowhere).

Other interesting Mandelbrot-set related functions that could also be Fourier transformed:
M_n(x,y) = the nth iterate of the Mandelbrot equation (f = |exp(-(lim(n->infinity) M_n)/n)|).
D(x,y) = distance between x+iy and the closest point in the Mandelbrot set. Phase could also encode direction.
P(x,y) = the potential field around an electrically charged Mandelbrot set.

Simplicity density function

Friday, August 29th, 2008

A commenter on Tuesday’s post wondered what the density function of numbers with low complexity looks like. This seemed like an interesting question to me too, so I wrote some code to find out. This is the result:

Simplicity density function

I actually used a slight modification of the complexity metric (L(exp(x)) == L(-x) == L(log(x)) == L(x)+1, L(x+y) == L(x)+L(y)+1, L(0) == 1) and a postfix notation instead of a bracketing one. These are all the numbers x with L(x)<=20. More than that and my program takes up too much memory without some serious optimization.

The smooth curves and straight lines are functions of the real line (which is quite densely covered). The strong horizontal lines above and below the center (0) lines are +πi and -πi, which occur from taking the logarithm of a negative real number. There is a definite fractal nature to the image and lots of repetition (as one would expect, since every function is applied to every previously generated point up to the complexity limit).

I didn’t add duplicate elimination rules for duplicates that didn’t appear until L(x)>=8 or so, so some points are hotter than they should be, but I don’t think fixing this would make the image look significantly different.

The code is here. This header file is also required for the Complex class, and this in turn requires this and this. The program is actually a sort of embryonic symbolic algebra program as it builds trees of expressions and pattern matches strings against them. It generates a 1280×1280 RGB image which I cropped down to 800×600. The colour palette is based on a thermal spectrum where temperature goes as an inverse seventh root of the number of hits on a pixel (no particular mathematical reason for that - I just think it makes it look nice). The points between black and red are fudged a bit.

Overlapping images in escape time fractals

Tuesday, July 15th, 2008

This is a post I made on sci.fractals recently (it didn’t get any replies there though).

I’ve been playing about with drawing escape time fractals using different formulae. I’ve noticed that some formulae give images which seem to have a strange feature - in some places it looks like there are two overlapping images, with one image showing through in areas of the other.

For example, here is an image I made using the formula
z <- (z+1)*(z+c)*(z+i)

Can anybody help me to understand what is going here? Are there really two iterative process going on hidden in one formula or is it an illusion? Does this phenomenon have a name that I could search for to find out more about it?