Benoît Mandelbrot is a mathematician best known for the fractal shown here, which is generally referred to as the Mandelbrot set. Biography on this impressive man is available from wikipedia: Benoît Mandelbrot. This page will deal primarily with his fractal set.
- You can play with the Mandelbrot's fractal here [1]
Contents |
The Mandelbrot set
The Mandelbrot set is an infinitely large set of complex numbers whose distance to the origin remains bound (less than infinty) for any number of iterations of the fractal algorithm developed by Monsieur Mandelbrot. If you're unfamiliar with fractals, this may sound confusing, but I hope it will become clear by the end of the section.
The algorithm developed by Monsieur Mandelbrot is fairly simple. Beginning with a complex number, the algorithm simply squares the number, and then adds the original value. So, for a complex number Z0, the Mandelbrot fractal algorithm defines the array of points Zn such that Zn = (Zn-1)2 + Z0. The complex number Z0 is a member of the Mandelbrot set if and only if the distance from the origin (0) to Zn is less than infinity for all n.
Note that it has been shown that if the distance of Zn ever surpasses 2, than it will eventually escape to infinity and is therefore not part of the Mandelbrot set. For practical purposes when calculating points in the set, we typically limit the number of iterations performed (the maximum value of n), and if a point has not broken past 2 within that many iterations, we estimate that it is a member of the set.
Example (1+j)
- see also: Complex arithmetic
- Z0 = 1 + j1
- Z1 = (Z0)2 + Z0
- Z1 = (1 + j)(1 + j) + (1 + j)
- Z1 = (1 + j + j + j2) + (1 + j)
- Z1 = (1 + j + j + − 1) + (1 + j)
- Z1 = (0 + j2) + (1 + j)
- Z1 = 1 + j3
- | Z1 | = 3.1623
Therefore, after just a single iteration, the complex number 1 + j escapes the threshold of 2, and is therefore not a member of the Mandelbrot set.
Example (0.5,0)
- see also: Complex arithmetic
- Z0 = 0.5 + j0
- Z1 = (Z0)2 + Z0
- Z1 = (0.5 + 0)(0.5 + 0) + (0.5 + 0)
- Z1 = (0.25 + 0) + (0.5 + 0)
- Z1 = 0.75 + j0
- |Z1| = sqrt(0.752 + 02)
- |Z1| = 0.75
Z1 hasn't broken the threshold yet, so we iterate again:
- Z2 = (Z1)2 + Z0
- Z2 = (0.75 + 0)(0.75 + 0) + (0.5 + 0)
- Z2 = (0.5625 + 0) + (0.5 + 0)
- Z2 = 1.0625 + j0
- |Z2| = sqrt(1.06252 + 02)
- |Z2| = 1.0625
It still hasn't broken the threshold (2), so we would iterate again, which I don't feel like doing just now. But you would continue to iterate until the distance to the point from the origin (the magnitude of the point) reaches 2 (or above), or until you've iterated enough times to convince yourself it will never break free, in which case you count it as part of your Mandelbrot set estimation (it's an estimation because you'd have to iterate an infinite number of times (or prove mathematically it will never reach infinity) in order for it to be exact).
Computerized computation
Conveniently, Monsieur Mandelbrot was the first person to use a digital computer to compute a fractal set. It's easy enough to do with this fractal, in whatever language you prefer. Here's some pseudo code. Perhaps in the future, I'll post some real code.
//Typical display bounds to see the "whole" set double xmin = -2.5; double xmax = 1.5; double ymin = 2; double ymax = 2; //Define the number of points to calculate int xres = 300; int yres = 300; //Maximum number of iterations int nmax = 32; //Figure out how far apart the points are double xrange = xmax - xmin; double yrange = ymax - ymin; double dx = xrange/xres; double dy = yrange/yres; //Set up our matrix. This will store out "n-values" in a matrix which corresponds to the // display matrix. Some simple arithmetic will get you the actual complex-plane // coordinates of each cell. int mat [][] = new int[xres][yres]; //declare bunch of variables int j, n; double dd, e, f, x, y, x0, y0; //Loop over each row for(int i=0; i<xres; i++){ //Loop over each cell in the current row for(j=0; j<yres; j++){ //Calculate the complex-plane coords of the current cell. // x is real, y is imaginary. x0 = x = xmin + i*dx; y0 = y = ymin + j*dy; //Iteration counter n=0; //Squared distance dd = x*x + y*y; //iterate as long as we're under threshold, and max iterations while(dd < 4 && n < nmax){ //temp vars to hold new x,y values e = x*x - y*y + x0; f = 2*x*y + y0; x = e; y = f; dd = x*x + y*y; n++; } //Store the n-val mat[i][j] = n; } }
Graphic depiction
The graphic depictions you're probably used to seeing of the Mandelbrot set are done by simply plotting each point on the complex plane (with the real part of the value on one axis, usually the horizontal, and the imaginary value on the other), and coloring the point based on the number of iterations required to break the distance-of-2 threshold. A colormap is established with a specific color for each integer from 0 up to the maximum number of iterations, and each point is mapped to the appropriate color based on it's "n-value". The last color in the map (the highest index) is usually made a special color, frequently white or black. This is the color for points which don't break the threshold, in other words, those points which are estimated to be in set. The rest of the colormap is usually some sort of gradient, or rainbow, or some such thing.
See also
Categories: Mandelbrot set | Math
Science > Math
Science > Math > Complex numbers
Science > Math > Fractals > Complex plane fractals
Science > Math > Fractals > Mandelbrot set
