Skip to main content
2 of 3
added 159 characters in body
aschepler
  • 947
  • 4
  • 6

Octave (212 143 bytes)

[x,y]=meshgrid(-2:.01:2);z=c=x+i*y;m=0*e(401);for n=0:99;m+=abs(z)<2;z=z.^2+c;end;imagesc(m);colormap([hsv(128)(1+mod(0:79:7900,128),:);0,0,0]) 

With whitespace:

[x,y] = meshgrid(-2:.01:2); z = c = x + i*y; m = 0*e(401); for n=0:99 m += abs(z)<2; z = z.^2 + c; end imagesc(m) colormap([hsv(128)(1+mod(0:79:7900,128),:); 0,0,0]) 

Output:

Mandelbrot steps to abs(z)>2

This would likely work on Matlab too. (Last time I used Matlab, it did not support +=, so fixing that might add one byte. But that was a long time ago.)

My first answer (212 bytes):

[x,y]=meshgrid(-2:.01:2);z=c=x+i*y;m=0*e(401);for n=0:99;m+=abs(z)<2;z=z.^2+c;endfor;t=[0*e(1,7);2.^[6:-1:0]];[s{1:7}]=ndgrid(num2cell(t,1){:});t=1+sum(cat(8,s{:}),8);imagesc(m);colormap([hsv(128)(t(:),:);0,0,0]) 
aschepler
  • 947
  • 4
  • 6