## segunda-feira, 6 de dezembro de 2010

### Mandelbrot Set

The Mandelbrot set M is defined by a family of complex quadratic polynomials
$P_c:\mathbb C\to\mathbb C$
given by
$P_c: z\mapsto z^2 + c$, where c is a complex parameter.

If the sequence $(0, P_c(0), P_c(P_c(0)), P_c(P_c(P_c(0))), \ldots)$ (starting with $z=0$) does not escapes to infinity, the complex number c is said to belong to the set.

A simple Octave/Matlab code was created to plot the complex numbers on the Mandelbrot set.

mset=[];x=[-2:0.001:1];y=[-1:0.001:1];k=0;for k1=1:length(x),for k2=1:length(y),    c=x(k1)+i*y(k2);    z=0;    for it=1:100,        z = z^2+c;    end;    if(z < Inf), k++; mset(k)=c; end;end;end;figure; plot(mset,'k.');