Buddhabrot +(+ Antibuddhabrot)
Edit: It's a proper Buddhabrot now!
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;
}
This one looks a bit like a faded photograph... I like that.