Skip to main content
added 144 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

Edit: I managed to cap the colour intensity within the byte limit, so there are no more falsely black pixels due to overflow.

I really wanted to stop after four... but...

enter image description hereenter image description here

enter image description hereenter image description here

unsigned short RD(int i,int j){
    #define f(a,b)for(a=0;++a<b;)
    #define D float x=0,y=0
    static int z,m,n;if(!z){z=1;f(m,4096)f(n,4096)BL(m-4096,n-4096);};return GR(i,j);
}
unsigned short GR(int i,int j){
    #define R a=x*x-y*y+i/1024.+2;y=2*x*y+j/1024.+2
    static float c[DIM][DIM];ifc[DIM][DIM],p;if(i<0i>=0)c[j+DIM][i/2+DIM]+=i%2*2+1;else return c[i][j];(p=c[i][j])>DM1?DM1:p;c[j+DIM][i/2+DIM]+=i%2*2+1;
}
unsigned short BL(int i,int j){
    D,a,k,p=0;if(i<0)f(k,5e5){R;x=a;if(x*x>4||y*y>4)break;GR(int((x-2)*256)*2-p,(y-2)*256);if(!p&&k==5e5-1){x=y=k=0;p=1;}}else{return GR(i,j);}
}

I really wanted to stop after four... but...

enter image description here

enter image description here

unsigned short RD(int i,int j){
    #define f(a,b)for(a=0;++a<b;)
    #define D float x=0,y=0
    static int z,m,n;if(!z){z=1;f(m,4096)f(n,4096)BL(m-4096,n-4096);};return GR(i,j);
}
unsigned short GR(int i,int j){
    #define R a=x*x-y*y+i/1024.+2;y=2*x*y+j/1024.+2
    static float c[DIM][DIM];if(i<0)c[j+DIM][i/2+DIM]+=i%2*2+1;else return c[i][j];
}
unsigned short BL(int i,int j){
    D,a,k,p=0;if(i<0)f(k,5e5){R;x=a;if(x*x>4||y*y>4)break;GR(int((x-2)*256)*2-p,(y-2)*256);if(!p&&k==5e5-1){x=y=k=0;p=1;}}else{return GR(i,j);}
}

Edit: I managed to cap the colour intensity within the byte limit, so there are no more falsely black pixels due to overflow.

I really wanted to stop after four... but...

enter image description here

enter image description here

unsigned short RD(int i,int j){
    #define f(a,b)for(a=0;++a<b;)
    #define D float x=0,y=0
    static int z,m,n;if(!z){z=1;f(m,4096)f(n,4096)BL(m-4096,n-4096);};return GR(i,j);
}
unsigned short GR(int i,int j){
    #define R a=x*x-y*y+i/1024.+2;y=2*x*y+j/1024.+2
    static float c[DIM][DIM],p;if(i>=0)return(p=c[i][j])>DM1?DM1:p;c[j+DIM][i/2+DIM]+=i%2*2+1;
}
unsigned short BL(int i,int j){
    D,a,k,p=0;if(i<0)f(k,5e5){R;x=a;if(x*x>4||y*y>4)break;GR(int((x-2)*256)*2-p,(y-2)*256);if(!p&&k==5e5-1){x=y=k=0;p=1;}}else{return GR(i,j);}
}
added 307 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

This gets slightly compressed during upload (and shrunk upon embedding) so if you want to admire all the detail, here is the interesting 512x512 cropped out (which doesn't get compressed and is displayed in its full size):

enter image description here

Thanks to githubphagocyte for the idea. This required some rather complicated abuse of all three colour functions:

Thanks to githubphagocyte for the idea. This required some rather complicated abuse of all three colour functions:

This gets slightly compressed during upload (and shrunk upon embedding) so if you want to admire all the detail, here is the interesting 512x512 cropped out (which doesn't get compressed and is displayed in its full size):

enter image description here

Thanks to githubphagocyte for the idea. This required some rather complicated abuse of all three colour functions:

added 1899 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

Buddhabrot +(+ Antibuddhabrot)

Edit: It's a proper Buddhabrot now!

enter image description hereenter image description here

unsigned short RD(int i,int j){
    #define f(a,b)for(a=0;++a<DIM;a=0;++a<b;)
    static#define intD z;floatfloat x=0,y=0
    static int z,m,n,k;ifn;if(!z){z=1;f(m,4096)f(n,4096)GRBL(m-DIM4096,n-DIM4096);};return BLGR(i,j);
}
unsigned short GR(int i,int j){
    float#define x=0,y=0,a,k;if(i<0)f(k){R a=x*x-y*y+(i+256.0)y*y+i/512;y=2*x*y+(j+5121024.0)+2;y=2*x*y+j/512;x=a;if(x*x+y*y>4)break;BL((x-1024.6)*512,+2
    static float c[DIM][DIM];if(y-1)*512i<0);}c[j+DIM][i/2+DIM]+=i%2*2+1;else return BL(i,j);c[i][j];
}
unsigned short BL(int i,int j){
    static float c[DIM][DIM];ifD,a,k,p=0;if(i<0&&i>-DIMi<0)f(k,5e5){R;x=a;if(x*x>4||y*y>4)break;GR(int((x-1&&j<0&&j>2)*256)*2-DIMp,(y-12)c[j+DIM][i+DIM]++;else if*256);if(i>0&&i<DIM&&j>0&&j<DIM!p&&k==5e5-1){x=y=k=0;p=1;}}else{return logGR(c[i][j]i,j)*110;;}
}

There are some bytes left for a better colour scheme, but so far I haven't found anything that beats the grey-scale image. It looks a bit like a faded photograph.

The code as given uses 4096x4096 starting points and does up to 500,000 iterations on each of them to determine if the trajectories escape or not. That took between 6 and 7 hours on my machine. IYou can get decent results with a 2k by 2k grid and 10k iterations, which takes two minutes, and even just a 1k by 1k grid with 1k iterations looks quite nice (that takes like that3 seconds). If you want to fiddle around with those parameters, there are a few places that need to change:

  • To change the Mandelbrot recursion depth, adjust both instances of 5e5 in BL to your iteration count.
  • To change the grid resolution, change all four 4096 in RD to your desired resolution and the 1024. in GR by the same factor to maintain the correct scaling.
  • You will probably also need to scale the return c[i][j] in GR since that only contains the absolute number of visits of each pixel. The maximum colour seems to be mostly independent of the iteration count and scales linearly with the total number of starting points. So if you want to use a 1k by 1k grid, you might want to return c[i][j]*16; or similar, but that factor sometimes needs some fiddling.

SinceOriginally, I don't have enough characters todidn't distinguish between escaping and non-escaping trajectories, this. That generated a plot which is the union of a Buddhabrot and an Antibuddhabrot (as pointed out by githubphagocyte).

unsigned short RD(int i,int j){
    #define f(a)for(a=0;++a<DIM;)
    static int z;float x=0,y=0,m,n,k;if(!z){z=1;f(m)f(n)GR(m-DIM,n-DIM);};return BL(i,j);
}
unsigned short GR(int i,int j){
    float x=0,y=0,a,k;if(i<0)f(k){a=x*x-y*y+(i+256.0)/512;y=2*x*y+(j+512.0)/512;x=a;if(x*x+y*y>4)break;BL((x-.6)*512,(y-1)*512);}return BL(i,j);
}
unsigned short BL(int i,int j){
    static float c[DIM][DIM];if(i<0&&i>-DIM-1&&j<0&&j>-DIM-1)c[j+DIM][i+DIM]++;else if(i>0&&i<DIM&&j>0&&j<DIM)return log(c[i][j])*110;
}

enter image description here

This one looks a bit like a faded photograph... I like that.

Buddhabrot + Antibuddhabrot

enter image description here

unsigned short RD(int i,int j){
    #define f(a)for(a=0;++a<DIM;)
    static int z;float x=0,y=0,m,n,k;if(!z){z=1;f(m)f(n)GR(m-DIM,n-DIM);};return BL(i,j);
}
unsigned short GR(int i,int j){
    float x=0,y=0,a,k;if(i<0)f(k){a=x*x-y*y+(i+256.0)/512;y=2*x*y+(j+512.0)/512;x=a;if(x*x+y*y>4)break;BL((x-.6)*512,(y-1)*512);}return BL(i,j);
}
unsigned short BL(int i,int j){
    static float c[DIM][DIM];if(i<0&&i>-DIM-1&&j<0&&j>-DIM-1)c[j+DIM][i+DIM]++;else if(i>0&&i<DIM&&j>0&&j<DIM)return log(c[i][j])*110;
}

There are some bytes left for a better colour scheme, but so far I haven't found anything that beats the grey-scale image. It looks a bit like a faded photograph... I like that.

Since I don't have enough characters to distinguish between escaping and non-escaping trajectories, this plot is the union of a Buddhabrot and an Antibuddhabrot (as pointed out by githubphagocyte).

Buddhabrot (+ Antibuddhabrot)

Edit: It's a proper Buddhabrot now!

enter image description here

unsigned short RD(int i,int j){
    #define f(a,b)for(a=0;++a<b;)
    #define D float x=0,y=0
    static int z,m,n;if(!z){z=1;f(m,4096)f(n,4096)BL(m-4096,n-4096);};return GR(i,j);
}
unsigned short GR(int i,int j){
    #define R a=x*x-y*y+i/1024.+2;y=2*x*y+j/1024.+2
    static float c[DIM][DIM];if(i<0)c[j+DIM][i/2+DIM]+=i%2*2+1;else return c[i][j];
}
unsigned short BL(int i,int j){
    D,a,k,p=0;if(i<0)f(k,5e5){R;x=a;if(x*x>4||y*y>4)break;GR(int((x-2)*256)*2-p,(y-2)*256);if(!p&&k==5e5-1){x=y=k=0;p=1;}}else{return GR(i,j);}
}

There are some bytes left for a better colour scheme, but so far I haven't found anything that beats the grey-scale image.

The code as given uses 4096x4096 starting points and does up to 500,000 iterations on each of them to determine if the trajectories escape or not. That took between 6 and 7 hours on my machine. You can get decent results with a 2k by 2k grid and 10k iterations, which takes two minutes, and even just a 1k by 1k grid with 1k iterations looks quite nice (that takes like 3 seconds). If you want to fiddle around with those parameters, there are a few places that need to change:

  • To change the Mandelbrot recursion depth, adjust both instances of 5e5 in BL to your iteration count.
  • To change the grid resolution, change all four 4096 in RD to your desired resolution and the 1024. in GR by the same factor to maintain the correct scaling.
  • You will probably also need to scale the return c[i][j] in GR since that only contains the absolute number of visits of each pixel. The maximum colour seems to be mostly independent of the iteration count and scales linearly with the total number of starting points. So if you want to use a 1k by 1k grid, you might want to return c[i][j]*16; or similar, but that factor sometimes needs some fiddling.

Originally, I didn't distinguish between escaping and non-escaping trajectories. That generated a plot which is the union of a Buddhabrot and an Antibuddhabrot (as pointed out by githubphagocyte).

unsigned short RD(int i,int j){
    #define f(a)for(a=0;++a<DIM;)
    static int z;float x=0,y=0,m,n,k;if(!z){z=1;f(m)f(n)GR(m-DIM,n-DIM);};return BL(i,j);
}
unsigned short GR(int i,int j){
    float x=0,y=0,a,k;if(i<0)f(k){a=x*x-y*y+(i+256.0)/512;y=2*x*y+(j+512.0)/512;x=a;if(x*x+y*y>4)break;BL((x-.6)*512,(y-1)*512);}return BL(i,j);
}
unsigned short BL(int i,int j){
    static float c[DIM][DIM];if(i<0&&i>-DIM-1&&j<0&&j>-DIM-1)c[j+DIM][i+DIM]++;else if(i>0&&i<DIM&&j>0&&j<DIM)return log(c[i][j])*110;
}

enter image description here

This one looks a bit like a faded photograph... I like that.

added 334 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975
Loading
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975
Loading