Subscribe to this RSS feed
Home
About Me
Hire Me
Contact Me
Essays
Login
Downloads


The Tragically Hip :: www.thehip.com

Rush

Total Posts: 116


What is a Mandelbrot Set Anyway?

Internet Explorer just crashed on me!  I now have to rewrite this.  I've gotta build Live Writer support into my site one of these days.  Anyway...
 
A Mandelbrot Set is a fractal.  It is a complex formula based image (more on that in a moment).  You pass values to define scale.  Wikipedia defines a Mandelbrot Set as (because I can't for the life of me remember the *real* definition) a set of points in the complex plane, the boundary of which forms a fractal. Mathematically, the Mandelbrot set can be defined as the set of complex c-values for which the orbit of 0 under iteration of the complex quadratic polynomial
    xn+1 = xn2 + c
remains bounded.  A Complex number, c, is in the Mandelbrot set if, when starting with x0=0 and applying the iteration repeatedly, the absolute value of xn never exceeds a certain number (that number depends on c) however large n gets.
 
Yeeeeaaaah.  Exactly.  Talk about a pain to remember.  I prefer to remember the code definition:
Math.ComplexNumber C = z;
int iteration = 0;
while (z.Modulus < escapeRadius && iteration < maxIteration)
{
    z = z * z + C;
    iteration++;
}

int colorIndex = 0;
if (iteration < maxIteration)
{
    z = z * z + C; iteration++;
    z = z * z + C; iteration++;
    double mu = iteration - (Math.Log(Math.Log(z.Modulus))) / logEscapeRadius;
    colorIndex = (int)(mu / maxIteration * 768);
    if (colorIndex >= 768) colorIndex = 0;
    if (colorIndex < 0) colorIndex = 0;
}
This specific example was found on http://llbb.wordpress.com/2007/04/12/mandelbrot-set-with-smooth-drawing-using-c/.  I'm looking for my original code that I used when studying Computer Science in high school.  But that was a long time ago.  Once I find the original code, I'll post an addendum.

Tags:
Written by Steve Syfuhs on 11/20/2008 4:55:44 PM | Views: 2673

Comments
Copyright 2008 Steve Syfuhs