Welcome to Fractal Forums

Fractal Software => Programming => Topic started by: laser blaster on May 05, 2014, 11:41:25 PM




Title: Halp! I can't implement Rudy Rucker's cubic mandelbrot correctly.
Post by: laser blaster on May 05, 2014, 11:41:25 PM
http://www.rudyrucker.com/blog/2010/04/02/the-rudy-set-fractal/ (http://www.rudyrucker.com/blog/2010/04/02/the-rudy-set-fractal/)

Hi, there. I'm trying to learn about higher-order mandelbrot-like sets (more than the simple multibrots), and Rudy Rucker has a good introduction to cubic Julia and Mandelbrot sets. I've succeeded at coding the kind of cubic fractal where the k parameter is a fixed constant, and the c parameter is set equal to the fixed position. I'm rendering the connectedness map using both critical points ( That is, i'm coloring black the points for which neither critical point escapes)

I noticed he made a mistake: the critical points are at +/- sqrt(k), not +/- k , but since I seem to be able to exactly mimic his results using the correct critical points for many pictures, I'm assuming it was just a typo and he actually implemented it correctly.

Now, when I get to what he calls the Rudy Set, I can't match his results. It looks like he is setting both the K and C parameters equal to the pixel position
He uses the notation :
    R = {c : Jcc is connected}
    = {c : c is in Mc}
    = {c : ( c-fcc– > FINITE ) AND ( -c –fcc– > FINITE) }     

I've tried implementing the formula as I understand it, and my results look different. I've tried using +/- sqrt(c) for the critical points, and also just +/- c (as his formula incorrectly suggests), and I get something totally different. I attached a picture (using the correct critical points).

Here is my fragmentarium code:
Code:
vec2 complexSqrt( vec2 a) {
vec2 ret;
float r = length(a);
ret = sqrt(r) * normalize (a + vec2(r,0.));
if( a.y==0) {
if(a.x < 0) a.x = -a.x;
else if (a.x == 0) ret = vec2(0.,0.);
}
return ret;
}

vec3 color(vec2 c) { // c is the pixel position
crit1 = complexSqrt(c);
crit2 = - crit1;

vec2 z = crit1;

int i = 0;
for (i = 0; i < Iterations; i++) {
z = complexMul(z,complexMul(z,z)) - 3. *  complexMul(c,z) + c;

if (dot(z,z)> 100.0) break;
}
vec2 z2 =crit2;
int j = 0;
for (j = 0; j < Iterations; j++) {
z2 = complexMul(z2,complexMul(z2,z2)) - 3. *  complexMul(c,z2) + c;

if (dot(z2,z2)> 100.0) break;
}
if (j< i) {z = z2; i = j;}


if (i < Iterations) {
. . . //perform coloring using i and z
}  else {
return vec3(0.0);
}


Title: Re: Halp! I can't implement Rudy Rucker's cubic mandelbrot correctly.
Post by: phtolo on May 06, 2014, 12:59:18 PM
Take a look at http://formulas.ultrafractal.com/cgi/formuladb?browse (http://formulas.ultrafractal.com/cgi/formuladb?browse)

If you scroll down a bit you can find the ultrafractal files for Rucker's work.



Title: Re: Halp! I can't implement Rudy Rucker's cubic mandelbrot correctly.
Post by: laser blaster on May 06, 2014, 10:12:33 PM
Thanks, that helped a lot. Turns out the difference was that he was setting the position of the critical points equal to +/- pixel position, and then squaring it to get the K parameter for the formula. I was setting K equal to pixel position, and then taking the square root to get the critical points. I think both are equally valid approaches, but they produce different results.

By the way, I wonder why cubic and higher-order fractals haven't gotten much attention. Cubic connectedness maps (such as the one posted above) usually look messy and unkempt, but the sets drawn for only one of the two critical points (or the union of both such sets) can look gorgeous. You get the same elephant, scepter, spiral, and seahorse forms as in the Mandelbrot set, but with a distinctly cubic flair, plus you get plain old quadratic Mandelbrot sets embedded inside. I see a lot of potential for shape stacking.


Title: Re: Halp! I can't implement Rudy Rucker's cubic mandelbrot correctly.
Post by: phtolo on May 07, 2014, 10:03:07 PM
Wrote about a very simple variant a few months ago that aparently yields very similar results to Rucker's.

See the similarity between Detail of MandelCubicInvasionOfTheHrull and the picture below.

Use the standard m-set forumla but simply switch between using c from the m-set and a julia-set every other iteration.
On this image for the first three iterations I used c from a julia-set and the next three iterations I used c from the m-set, then repeat.

(http://www.phtolo.se/fractals/mandel/part1/varannan-37.jpg)