Julia sets and altering the iterate afterwards

  • 19 Replies
  • 842 Views

0 Members and 1 Guest are viewing this topic.

Offline marcm200

  • *
  • Fractal Freak
  • **
  • Posts: 727
« on: June 10, 2019, 08:24:49 PM »
I found a very interesting technique in the old forum for altering Julia sets after one has computed the new iterate.

http://www.fractalforums.com/mandelbrot-and-julia-set/a-beautiful-method-for-modifying-julias-mandelbrots-not-so-much-in-2d/ (credit to M Benesi).

I randomly chose some c values with some thrown-together formulas (constructed without much thought, just to see whether there is a variation and if so, of what sort).

Has anyone done a thorough exploration of that concept - changing the value of the iterate, so basically applying two functions, one sectionally defined in a single iteration?

The image contains three iteration types (z^2, z^3, z^6) and the used variations: After computing the iteration zn+1 do: (n+1 has been omitted from now on):

var 1: if (re(z) > fabs(im(z))) re(z) = 0.5*(cos(re(z))+sin(im(z)));
var 2: if (re(z) > fabs(im(z))) re(z) = 0.5*(cos(2*re(z))-sin(im(z)));
var 3: if (re(z) > fabs(im(z))) re(z)=-re(z);
var 4: if (im(z) > fabs(re(z))) im(z) = -0.5*(cos(2*re(z))-sin(im(z)));
var 5: if (re(z) > fabs(im(z))) re(z) = log(fabs(re(z)+im(z)));
var 6: if (re(z) < log(fabs(im(z)))) im(z) = -re(z)+sin(im(z));
var 7: if (sin(re(z)) > cos(im(z))) re(z) = -log(fabs(im(z)));
var 8: if (re(z) > (cos(re(z))*im(z))) re(z) = -0.5*(re(z)+im(z));

before next iteration starts.


Linkback: https://fractalforums.org/fractal-mathematics-and-new-theories/28/julia-sets-and-altering-the-iterate-afterwards/2871/

Offline Sabine62

  • *
  • 3c
  • ***
  • Posts: 805
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #1 on: June 11, 2019, 11:55:23 AM »
Oh great, thank you for posting, Marc!  :thumbs: I am always interested in new transforms.
Applied yours to the mandelbulb, nice results.
I have three more for you if you are interested:

invcylindrical:
if (invcylindrical) {
         z.x=z.x*cos(z.y);
         z.y=z.x*sin(z.y);
      }

log:
if (LogX)(z.x = log(z.x + sqrt(z.x*z.x + 1.))); Sorry, had the transform for the vec3 LogZ here  :embarrass:

sin:
if (SinX)(z.x = sin(z.x )+(z.x));


Would it be ok if I added your transforms to Fragmentarium's Code Snippets-section on this forum (of course with proper credits! ;) )?
« Last Edit: June 11, 2019, 05:57:52 PM by Sabine62 »
To thine own self be true

Offline Sabine62

  • *
  • 3c
  • ***
  • Posts: 805
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #2 on: June 11, 2019, 01:47:25 PM »
Just found that combining SinX with SinY is good idea too ;)

Offline marcm200

  • *
  • Fractal Freak
  • **
  • Posts: 727
« Reply #3 on: June 11, 2019, 03:23:27 PM »
Would it be ok if I added your transforms to Fragmentarium's Code Snippets-section on this forum?

Sure thing. Go ahead!

I like how different the outcomes of your transformations are. The ones I use, often are mainly spike-y in nature, not sure why.

Do you apply your transformations in every iteration - or just after a conditional check like if re(z.x) < im(z.y) or something like that? (Now that I'm writing this, maybe that's the spike reason?)

EDIT: Of course, I meant to say: if z.x < z.y (too many formulas floating in my head).
« Last Edit: June 11, 2019, 04:47:29 PM by marcm200, Reason: if-condition was written incorrectly »

Offline gerson

  • *
  • Fractal Fluff
  • *****
  • Posts: 363
« Reply #4 on: June 11, 2019, 04:41:45 PM »
@Sabine62 Very nice images, are mb3d, mandelbulber or fragmentarium?

Offline Sabine62

  • *
  • 3c
  • ***
  • Posts: 805
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #5 on: June 11, 2019, 10:26:01 PM »
@marcm200 Thank you very much! :)  :thumbs:
I will add to the Code Snippets asap.

The images above are all with the code placed in the iteration loop. I have attached for comparison one image with the transform within the iteration loop and one with the transform used as post-transform. I used the same conditions as you (at least, I translated the real and imaginary numbers to z.x and z.y so Fragmentarium understands me ;) ), within the loop and post-iteration. The nice thing with your transforms is that the conditions could be anything, in Fragmentarium f.i. I could use a boolean uniform checkbox for user input.

@gerson Thank you! and it's Fragmentarium, Mandelbulber wants to kill my computer, I am pretty sure of it  ;D



Offline kosalos

  • *
  • Fractal Friar
  • *
  • Posts: 127
« Reply #6 on: August 24, 2019, 01:27:02 PM »
You can do a whole lot of damage by applying your idea to the Apollonian as well.

control.foam = 0.1 ... 3
control.foam2 = 0.1 ... 3
control.bend = 0.01 ... 0.03
control.multiplier = 10 ... 300
control.maxSteps = 2 ... 10
control.alterIterate =  0.5 ... 2

float DE_APOLLONIAN(float3 pos, Control &control) {
    float k,t = control.foam2 + 0.25 * cos(control.bend * PI * control.multiplier * (pos.z - pos.x));
    float scale = 1;
 
    for(int i=0; i< control.maxSteps; ++i) {
        pos = -1.0 + 2.0 * fract(0.5 * pos + 0.5);
        k = t / dot(pos,pos);
        pos *= k * control.foam;
        scale *= k * control.foam;

        pos.x += sqrt(pos.x * pos.x + control.alterIterate);  //  <-- added this 
    }
   
    return 1.5 * (0.25 * abs(pos.y) / scale);
}

Offline gerson

  • *
  • Fractal Fluff
  • *****
  • Posts: 363
« Reply #7 on: August 26, 2019, 09:02:18 PM »
@kosalos Keeping the top level. Congratulations.

Offline kosalos

  • *
  • Fractal Friar
  • *
  • Posts: 127
« Reply #8 on: August 28, 2019, 01:03:49 AM »
It's easy to produce all kinds of vegetable by slightly altering the Mandelbulb DE formula:

control.power = 6.3  (0.5 ... 20)
control.maxSteps = 6 (3 ... 30)
control.radialAngle = 0.4 (0.01 ... 50)

float DE_MANDELBULB(float3 pos,device Control &control) {
    float dr = 1;
    float r,theta,phi,pwr,ss;
   
    float3 oldPos = pos;
    float lettuce;
   
    for(int i=0; i < control.maxSteps; ++i) {
        r = length(pos);
        if(r > 2) break;
       
        lettuce = control.radialAngle / length(0.001 + oldPos - pos);
        oldPos = pos;
       
        // original:   theta = atan2(length(pos.xy), pos.z);
        theta = atan2(length(pos.xy) * lettuce, pos.z);     // <-- added 'lettuce' effect
       
        phi = atan2(pos.y,pos.x)  * control.power;
        pwr = pow(r,control.power);
        ss = sin(theta * control.power) * pwr;
       
        pos.x += ss * cos(phi);
        pos.y += ss * sin(phi);
        pos.z += pwr * cos(theta * control.power);
       
        dr = (pow(r, control.power - 1.0) * control.power * dr ) + 1.0;
    }
   
    return 0.5 * log(r) * r/dr;
}


Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 753
« Reply #9 on: August 28, 2019, 12:31:31 PM »
having a look :)

  z = newZ + c     versus   z = oldZ plus newZ   

 (with a bit of lettuce)

Offline kosalos

  • *
  • Fractal Friar
  • *
  • Posts: 127
« Reply #10 on: August 28, 2019, 05:13:31 PM »
Thanks mclarekin,
I like yours better than what I stumbled across.
Can you post your DE() formula?
I don't know how you map the 2D Mandebrot equation into the 3D Mandelbulb.

Here's my attempt:

control.radialAngle:   0 ... 50

float DE_MANDELBULB(float3 pos,device Control &control) {
    float dr = 1;
    float r,theta,phi,pwr,ss;

    float3 oldPos = pos;
    float lettuce;
   
    for(int i=0; i < control.maxSteps; ++i) {
        r = length(pos);
        if(r > 2) break;

        lettuce = control.radialAngle / length(0.001 + oldPos - pos);  // lettuce effect on current position
        oldPos = pos;
        pos *= (1 - lettuce/100);

        theta = atan2(length(pos.xy), pos.z); 
        phi = atan2(pos.y,pos.x)  * control.power;
        pwr = pow(r,control.power);
        ss = sin(theta * control.power) * pwr;
       
        pos.x += ss * cos(phi);
        pos.y += ss * sin(phi);
        pos.z += pwr * cos(theta * control.power);

        dr = (pow(r, control.power - 1.0) * control.power * dr ) + 1.0;
    }

    return 0.5 * log(r) * r/dr;
}

Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 753
« Reply #11 on: August 29, 2019, 04:59:32 AM »
yes ,  lettuce = 1 - lettuce was used for my images, modifying it before entering:

theta = atan2(xyL * lettuce, z.z); // <-- added 'lettuce' effect

I am also testing the mix()     lettuce =  1 + (lettuce - 1) * scale, but i prefer the 1 - lettuce (with control.radialAngle  scaling the effect)

also i included a pos.z  += control.posZoffset at the end   (plus some other stuff that I need to test further)

I will post it for Fragmentarium when I have finished

The quality of the distance estimate is only average, but it wil be fun to animate

Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 753
« Reply #12 on: September 01, 2019, 12:49:10 PM »
i have finished my c++ version, next convert to glsl

this image  is from an option to  use the theta tweak (lettuce) on a standard z = f(z) + c mandelbulb

Offline kosalos

  • *
  • Fractal Friar
  • *
  • Posts: 127
« Reply #13 on: September 01, 2019, 02:43:25 PM »
I need help with my Distance Estimations.
My images are never as cool as yours.
In the meantime, here's a turnip:

control.cx = 0
control.cy = 0.245
control.cz = 0.525
control.radialAngle = 0.017
control.power = 10.23

float DE_MANDELBULB(float3 pos,device Control &control) {
    float dr = 1;
    float r,theta,phi,pwr,ss;

    float3 oldPos = pos;
    float lettuce;
   
    for(int i=0; i < control.maxSteps; ++i) {
        r = length(pos);
        if(r > 2) break;

        lettuce = control.radialAngle / length(0.001 + oldPos - pos);
        oldPos = pos;
        pos *= (lettuce/100);

        // theta = atan2(length(pos.xy), pos.z);
        theta = atan2(length(pos.xy) * lettuce, pos.z);

        phi = atan2(pos.y,pos.x)  * control.power;
        pwr = pow(r,control.power);
        ss = sin(theta * control.power) * pwr;
       
        pos.x += ss * cos(phi);
        pos.y += ss * sin(phi);
        pos.z += pwr * cos(theta * control.power);

        pos.x *= control.cx;
        pos.y *= control.cy;
        pos.z *= control.cz;
       
        dr = (pow(r, control.power - 1.0) * control.power * dr ) + 1.0;
    }

    return 0.5 * log(r) * r/dr;
}

Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 753
« Reply #14 on: September 02, 2019, 06:03:36 AM »
this is a quick update of your code, (i removed the c for now)

Code: [Select]
float DE_MANDELBULB(float3 pos,device Control &control) {
    float dr = 1;
    float r,theta,phi,pwr,ss;

    float3 oldPos = pos;
    float lettuce;
   
    for(int i=0; i < control.maxSteps; ++i) {
        r = length(pos);
        if(r > 2) break;

        lettuce = control.radialAngle / length(0.001 + oldPos - pos);
        oldPos = pos;


       // pos *= (lettuce/100);
     lettuce = 1.0 - lettuce / 100.0; //llllllllllllllllllllllllll
   

        // theta = atan2(length(pos.xy) * lettuce, pos.z);
        theta = atan2(length(pos.xy * lettuce), pos.z); //lllllllllllllllllllllllllll

        phi = atan2(pos.y,pos.x)  * control.power;
        pwr = pow(r,control.power);
        ss = sin(theta * control.power) * pwr;
       
        pos.x += ss * cos(phi);
        pos.y += ss * sin(phi);
        pos.z += pwr * cos(theta * control.power);

        pos.z +=  control.offsetZ;  //llllllllllllllllllllllllll  tweak, default = 0.0
       
        dr = (pow(r, control.power - 1.0) * control.power * dr ) + 1.0;
    }

    return 0.5 * log(r) * r/dr;
}


clip
Period altering in polynomial Julia sets when combining iterations

Started by marcm200 on Fractal Mathematics And New Theories

2 Replies
215 Views
Last post July 22, 2019, 06:23:50 PM
by Adam Majewski
clip
Quadratic Julia sets

Started by pauldelbrot on Image Threads

12 Replies
859 Views
Last post November 23, 2019, 08:30:12 PM
by pauldelbrot
xx
Embedded Julia sets

Started by pauldelbrot on Image Threads

97 Replies
4998 Views
Last post June 26, 2020, 05:22:54 PM
by pauldelbrot
clip
Parabolic Julia sets

Started by marcm200 on Fractal Mathematics And New Theories

39 Replies
1219 Views
Last post July 06, 2020, 08:49:01 AM
by marcm200
clip
mating polynomial Julia sets

Started by claude on Fractal Mathematics And New Theories

9 Replies
383 Views
Last post January 21, 2020, 06:05:19 AM
by gerrit