Here is some updated code.
I'm going to post a quick non-trigonometric z^2,z^2 version (z^2 mag, z^2 mandy). By non-trigonometric I mean algebraic- it avoids calling trig functions which increases the speed quite a bit.
After that, I'll post a newer, easier trig version (a bit later). In a while,
if anyone is interested in it, I can post the complex numbers version of the formula- it is actually a LOT faster in ChaosPro as it avoids calling trig functions (converting to angle, converting back to cosine and sine, etc.).
Here is the z^2,z^2 version:
initialization sequence:
//I decided to use a simpler version of the mag vs. xyz formula
// It turned out a bit nicer, and a bit quicker to calculate as well
// REMEMBER THIS IS ONLY THE z^2 version, so !!!! mag_exponent=2 !!!
d=(mag_exponent + mag_exponent_variable)^2; // mag_exponent_variable should default to 1
// decreasing the variable makes a spikier fractal, increasing it makes it flatter
// In my ChaosPro formula, I like setting d= mag_exponent * 1.5 as well, for a
// slightly more connected higher mag_exponent fractals
// so for n= 4, d=6 I suppose we could default to:
// d=(mag_exponent * 1.5 + mag_exponent_variable)^2 with the variable=0 if we wanted
sx= x axis pixel value
sy= y axis pixel value
sz= z axis pixel value
pixelr=x axis pixel value
if (pixelr>0) then { pixelr = pixelr*.5 ; }
That's it for the initialization. We can eliminate a few square roots below by setting sqrt(1/2), sqrt(2/3), and sqrt(1/3) in the initialization. I just wanted to leave the formula the way it is so people can see the rotation matrices for now....
Here is the iteration loop:
whiskey= sqrt(2/3); //this is our rotation for the x-z plane
tango= sqrt(1/3);
nx= sx * whiskey - sz * tango;
sz= sx * tango + sz * whiskey;
sx=nx;
whiskey=sqrt(.5); // this is our rotation for the x-y plane
nx= sx * whiskey - sy * whiskey;
sy= sx * whiskey + sy * whiskey;
sx=nx;
sx=sx^2;
sy=sy^2;
sz=sz^2;
r=sx+sy+sz;
nx= (sx+r) * (d*sx-sy-sz) / (d*sx+sy+sz) + seed; //seed should default to -.5
ny= (sy+r) * (d*sy-sx-sz) / (d*sy+sx+sz) + seed; // that is negative 1/2....
sz= (sz+r) * (d*sz-sx-sy) / (d*sz+sx+sy) + seed;
sx=nx; // make sure you don't try to avoid this step!
sy=ny; //
whiskey= sqrt(.5); //time to rotate to the mandy!!!
tango= -whiskey; // notice the negative in this one!
nx=sx * whiskey -sy * tango;
sy=sx * tango + sy * whiskey;
sx=nx;
whiskey= sqrt(2/3);
tango= -sqrt(1/3); //notice the negative sqrt in this one?
nx= sx * whiskey - sz * tango;
sz= sx * tango + sz * whiskey;
sx=nx;
// time for our Mandy calculation- I've tried all kinds, this is the one I like most
// USE IT... IT is WAY BETTER!!@!#!@
sx2=sx^2; // don't need the additional variable- you can just square more than once
sy2=sy^2;
sz2=sz^2;
nx=sx2-sy2-sz2;
r3=2*sx/sqrt(sy2+sz2); //as long as sy2+sz2 != 0 of course.... :D
nz =r3*(sy2-sz2); // NOTE THAT Y AND Z VALUES ARE SWITCHED!#!@$#!
ny =r3*2*sy*sz; // Best for z^2... and other n=even but for odd n you
// want ny to be the first one and nz to be the second (switch back)
sx= nx + pixelr; // you might want to allow julia values to be added in
sy= ny; // as well-- and have the option of leaving out "pixelr"
sz= nz; // if only using julia values
//check bailout sx^2+sy^2+sz^2.... etc.
All right. I think that's it for the z^2 z^2 version. The multiple z^n version can wait for another time. It's basically the formula I posted back on page 4 of this thread, with a modified initialization that really helps with the details for higher n (n>2).
The z^2 z^2 is really cool.
The complex numbers version of the formula is really cool as well, and it's FAST compared to using trig functions. I actually wonder why people use so many trig functions- are GPUs really so optimized that the additional cycles of computation for trig functions are faster than avoiding them?
Noticed something interesting. You can add in the previous iterations X Value to the new iterations X Value and you get an interesting fractal as well. Different, of course...
Here is a z^2 with mag_exponent_variable=3, followed by part of the "flat mandy" type's elephant valley.
click to ENLARGE (especially the first one...)
Weird idea: You know how fractal antennas work very well, based on certain 2 dimensional fractals. Wonder how these 3 dimensional fractals would work? What if they absorb energy efficiently? You know what would be nice, warping spacetime.