Skip to main content
added 68 characters in body
Source Link
aschepler
  • 947
  • 4
  • 6

Octave (212 143136 bytes)

(Now including some ideas due to @ChrisTaylor.)

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

With whitespace:

[x[y,y]x] = meshgridndgrid(-2:.01:2); z = c = x + i*y; m = 0*e(401);c-c; 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)>2Mandelbrot steps to abs(z)>2

This would likely work on Matlab too. (Last time I usedTo convert to Matlab, it did not support +=change "m+=abs(z)<2" to "m=m+(abs(z)<2)". [+3 bytes]

To make the aspect ratio 1:1, so fixing that might add one byte. But that was a long time ago";axis image".) [+11 bytes]

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]) 

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]) 

Octave (212 136 bytes)

(Now including some ideas due to @ChrisTaylor.)

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

With whitespace:

[y,x] = ndgrid(-2:.01:2); z = c = x + i*y; m = c-c; 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

To convert to Matlab, change "m+=abs(z)<2" to "m=m+(abs(z)<2)". [+3 bytes]

To make the aspect ratio 1:1, add ";axis image". [+11 bytes]

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]) 
added 159 characters in body
Source Link
aschepler
  • 947
  • 4
  • 6

Octave - 212(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;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^2+c;end;imagesc(m);colormap([hsv(128)(t1+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; endfor t = [ 0*e(1,7); 2.^[6:-1:0] ]; [s{1:7}] = ndgrid(num2cell(t,1){:}); t = 1 + sum(cat(8,s{:}), 8);end imagesc(m) colormap([hsv(128)(t1+mod(0:79:7900,128),:);  0,0,0]) 

Output:

Mandelbrot steps to abs(z)>2Mandelbrot 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]) 

Octave - 212

[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]) 

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; 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]) 

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.)

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]) 
Source Link
aschepler
  • 947
  • 4
  • 6

Octave - 212

[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]) 

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; 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]) 

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.)