Mandelbrot set (warning: math content)

squeakywaffle

Active member
I dunno how many of you guys have heard of "imaginary numbers" or "fractals"... anyway, the most famous fractal (which I'm sure you've seen somewhere) is basically a picture of a certain set of imaginary numbers called the Mandelbrot set.

The set itself contains every complex (imaginary) number 'z' that doesn't cause the following sequence to blow up to infinity:

z(0) = z, z(n+1) = z(n)*z(n) + z, n = 1,2,3,4,....

Instead of doing my homework today, I wrote a computer program to "draw" the Mandelbrot set... these were some of the coolest images it produced:

1175597361-494101-600x482-1175597360mbrot1.png


1175597509-494103-600x482-1175597508mbrot3.jpg


It's amazing how such a simple formula can produce this beautiful result. You can make your viewing window as small as you want (and I did, though I have to do some fine-tuning before I can take good pictures) and you will always see the same incredible level of complexity, and you'll be seeing parts of the set that nobody has probably looked at before simply because it has that infinite complexity.

Anyone else ever play around with this stuff? The math isn't actually that complicated...
 
pretty cool stuff, that's for sure. simple math produces some pretty crazy things when you visualize it, most higher level math courses have at least a few cool looking things in it. I've always been fascinated by some of the 3-d shapes you get playing with pretty basic stuff in multi-d calc when you look at them in a 3-d graph... pretty cool stuff sometimes.
 
Chaotic systems are very cool, especially... a lot of differential equations will produce some very strange looking solutions that are incredibly sensitive to initial values. I sorta want to write a program to plot a "strange attractor" like the lorenz attractor, just because it looks cool.

I should really be doing the work I get graded on, though.
 
I used to make all sorts of sick graphs in AP Calc BC using Polar equations. I was the shit at it, not I purposely forgot everything, because I never have to take that stuff again. But it was good fun being a nerd in high school.
 
Ya, there is definitely some cool shit that can be done. I've had to write some code lately to simulate a thermal system over time (pretty boring), but when you plot the results, stuff looks pretty damn cool, you can see how things move to a steady state over time from where they begin initially, and the temperature distributions produce some pretty cool geometry..... God we're nerds, but whatever, I love it.
 
I'm telling you, go nuts and make it a three dimensional set. I saw that on the fridge this morning, cool shit. Whats the key to the color assignments you have?
 
Whether or not a number is in the set (these are colored dark blue) depends on whether or not the absolute value of the sequence ever exceeds 2. If it does, it will keep growing, but if not it will remain bounded.

But I can't iterate the sequence forever. So those colors represent numbers that cause the sequence to diverge after a certain number of iterations. I just color each number of iterations red, blue, or green in alternation.

With less iterations, more numbers are included in the dark blue, and the coloring on the fringe will look different. As iterations increase, more numbers get excluded from the set.

I have a better idea for coloring but it will take some smarter code... that's happening today.
 
Liberty has those as graphics on some of thier skis next year. Lame IMO but you might want to check it out
 
damn that second picture looks so sweet.

and we learned about imaginary numbers(z) this year, but not that in depth haha ((im only a freshman so....))
 
The set is generated with a C++ program (so it's super fast, much faster than matlab) and then drawn with a "Cocoa" program on my mac, just because that was the easiest thing I could come up with.

I could instead output the results to a file and have Matlab (or "gnuplot", in my case) plot it, but that would be less dynamic.

I have changed the coloring algorithm and it looks pretty sick now, I will post a picture later maybe.
 
bump

I wrote a new algorithm for coloring the fractal... it colors each number excluded from the set based on how many iterations it went for before it was excluded. Dark red = low iterations, bright blue/green = high iterations.

1175674370-494422-600x483-1175674369Picture1.jpg


1175674385-494423-379x522-1175674384Picture2.jpg


1175674399-494424-536x544-1175674398Picture3.jpg


The compression I have to use to post these on the internet really robs them of a lot of their clarity and beauty. If anyone with a mac wants my program, just pm me... you can click to zoom in on any point on the fractal almost endlessly... the clarity only gives out where the types of variables I use can't track the tiny tiny distances involved.
 
Yeah just pm me your email or something and I'll send it to you. Another guy wanted to see it too so I can send it to both you guys.

One thing, though, is that the math in the .cpp file doesn't really explain what's going on- it's deceptively simple. Wikipedia "mandelbrot set" and maybe "complex numbers" or "complex plane" or "euler's formula" to get a better idea what's going on.
 
Back
Top