### King's Dream Fractal - Investigation

• 29 Replies
• 978 Views

0 Members and 1 Guest are viewing this topic.

• 3d
• Posts: 986

#### Re: King's Dream Fractal - Investigation

« Reply #15 on: August 24, 2018, 02:20:04 PM »
Code: [Select]
  D[0][0] = a * d * sin(a * x[1]) - 1;    D[1][0] = -b * sin(b * x[1]);  D[0][1] = -a * sin(a * x[0]);  D[1][1] = b * c * sin(b * x[0]) - 1;
I haven't tried, but shouldn't all these sin really be cos?

#### Etymos

• Fractal Fanatic
• Posts: 26
• deep skyey voids above

#### Re: King's Dream Fractal - Investigation

« Reply #16 on: August 24, 2018, 02:23:18 PM »
I haven't tried, but shouldn't all these sin really be cos?

Oh crap, you're right, I feel so dumb right now.

• 3d
• Posts: 986

#### Re: King's Dream Fractal - Investigation

« Reply #17 on: August 24, 2018, 02:27:32 PM »
Does it work?

I just had a thought that maybe Newton's method might converge to a different root than iterating the point a whole bunch, don't know how to be sure...

#### Etymos

• Fractal Fanatic
• Posts: 26
• deep skyey voids above

#### Re: King's Dream Fractal - Investigation

« Reply #18 on: August 24, 2018, 02:55:52 PM »
Does it work?

I just had a thought that maybe Newton's method might converge to a different root than iterating the point a whole bunch, don't know how to be sure...

Well, yeah, kinda. I wrote some code that overlays the attractor and the fixed points (calculated via Newton).

Sometimes they are the same basically, but then the fixed points don't attract anymore, we get cycles of lenght > 1 and that's as far as I got.

Here is the code (currently animating over b, but that can be changed of course).

Code: [Select]
float D[][] = new float[2][2];float x[] = new float[2];float xnew[] = new float[2];float a, b, c, d, det, f1, f2;int t = 0;void setup() {  size(800, 800);  a = 1; b = -0.7; c = -2.23; d = -1.12;  x[0] = -2; x[1] = -2;  background(0);}void draw() {  background(0);  //delay(10);    b += 0.001;  println(b);  Newton();    float x, y, xp, yp;  for (int j = 0; j < 10; j++) {    xp = random(-4, 4);    yp = random(-4, 4);     for (int i = 0; i < 2000; i++) {      x = sin(yp * b) + c * sin(xp * b);      y = sin(xp * a) + d * sin(yp * a);       //if (i > 1800) {stroke(255); line(map(x, -5, 5, 0, 800), map(y, -5, 5, 800, 0), map(xp, -5, 5, 0, 800), map(yp, -5, 5, 800, 0)); noStroke(); fill(255, 0, 0); ellipse(map(x, -5, 5, 0, 800), map(y, -5, 5, 800, 0), 2, 2);}      if (i > 1800) {noStroke(); fill(255, 0, 0); ellipse(map(x, -5, 5, 0, 800), map(y, -5, 5, 800, 0), 2, 2);}      xp = x;      yp = y;      //println(x + " " + y);    }   }}void Newton() {  for (int i = 0; i < 30; i++) {  x[0] = random(-5, 5);  x[1] = random(-5, 5);    t = 0;  while (t < 50) {  t++;  D[0][0] = a * d * cos(a * x[1]) - 1;    D[1][0] = -b * cos(b * x[1]);  D[0][1] = -a * cos(a * x[0]);  D[1][1] = b * c * cos(b * x[0]) - 1;    det = D[0][0] * D[1][1] - D[0][1] * D[1][0];    D[0][0] /= det;  D[0][1] /= det;  D[1][0] /= det;  D[1][1] /= det;    f1 = sin(b * x[1]) + c * sin(b * x[0]) - x[0];  f2 = sin(a * x[0]) + d * sin(a * x[1]) - x[1];    xnew[0] = x[0] - (f1 * D[0][0] + f2 * D[1][0]);  xnew[1] = x[1] - (f1 * D[0][1] + f2 * D[1][1]);    //if (abs(x[0] - xnew[0]) < 0.00001 && abs(x[1] - xnew[1]) < 0.00001) {set(xs, ys, color(255)); break;}    x[0] = xnew[0];  x[1] = xnew[1];  }      noStroke();   fill(255, 255, 0);   ellipse(map(x[0], -5, 5, 0, width), map(x[1], -5, 5, height, 0), 10, 10);    }}
Also I have the impression that Newton's method is wicked fast in finding fixed points!

• 3d
• Posts: 979

#### Re: Lyapunov noise

« Reply #19 on: August 24, 2018, 05:15:15 PM »
I only ever did the forced logistic one. And these look awesome by the way!

Thanks!

#### Etymos

• Fractal Fanatic
• Posts: 26
• deep skyey voids above

#### Lyapunov noise - further observations

« Reply #20 on: August 31, 2018, 07:31:45 PM »
The noise in the Lyapunov maps is harder to combat than I thought. But I made some new observations.

Inside the Lyapunov map there are two (or more??) kind of noise factors.

For the first one: Multiple cycles. There are two or more cycles to be reached, and the point stays in one of them once reached. Now say these cycles have different Lyapunov exponents. If a point is chosen at random, two nearby pixels can differ a lot, because one might reach a very different cycle in the attractor than the other.

There is a simple fix for this (albeit not a very good one). Just set the starting values for x and y to some chosen value and use them for the whole picture. This removes most of the noise.

But there is more noise I haven't noticed before which cuts this idea short.

The second kind of noise is noise within the map of attraction - I mean that very close points can drastically differ in the cycles they end up in.

In a lot of cases there are just big areas with smooth bounderies within the map of attraction. But sometimes there is real noise, real chaos.

This is troubling because any attempt at choosing a fixed starting point is dead before it even started - because there is still noise!

I might have to do some super-sampling... Sigh. There seems not really any other option.

Check out, for example, the map of attraction for this set of parameters:

$a = 0.7408,\ b = 2.0506,\ c = 1.4,\ d = 1.2$

This attractor has three different cycles. Two fixed points and one two-cycle.

Then we have a few Lyapunov maps in the axb-plane. The first one has a random starting point each time, the second one has starting point always at (-2, -2). Observe how some noise vanished, others not! Note that some parts disappear, while some fractal patterns appear. These patterns might make some good pictures on their own (altough at that point it is simply art and not really a very meaningful map of the system).

#### Etymos

• Fractal Fanatic
• Posts: 26
• deep skyey voids above

#### What makes the map of attraction interesting?

« Reply #21 on: September 01, 2018, 01:56:10 PM »
I have done a search for sets of parameters with 4 fixed attracting points and no other cycles.

Then I made the maps of attraction.

They pose some interesting questions:
How can we quantify "interesting"? I'd consider intricate boundaries interesting, but how can we put this into numbers? This is especially because we need to say that some seed is more interesting than another seed. And there might be seeds that are boring, some showing some level of detail and some that are completly crazy.
Where are interesting maps in the parameter space?

• 3d
• Posts: 979

#### Re: King's Dream Fractal - Investigation

« Reply #22 on: September 01, 2018, 02:42:20 PM »

For each parameter point:

• Sample a small grid of dynamic points, say 10x10. Run them all for N iterations.
• For each interior point (8x8) take the eight neighbors' Nth iterates and average them, then divide by the interior point's Nth iterate.
• If neighboring dynamic points aren't very different in fate, these will tend to be close to 1. Interior points near unstable periodic points or boundaries of basins of attraction will generate numbers far from 1.
• Take the logarithm, so boring points end up near 0 and interesting ones far from 0.
• Take some function over these 64 numbers, e.g. average, or maximum modulus.
• Color the parameter point by this.

To find interesting parameter space slices the same thing can be done. If parameters are divided into c, determining the pixel, and d, a vector of everything else, make a sample where c is the pixel, d is within some grid, and the dynamic point is fixed. Apply the above to the d grid to generate a value for c. Even if the resulting c-plane image is boring, the parts of it with colors representing logarithms far from 0 will correspond to interesting pictures in (slices of) the d space.

• 3d
• Posts: 979

#### Re: King's Dream Fractal - Investigation

« Reply #23 on: September 01, 2018, 02:55:51 PM »
Other variations:

a) Sample e.g. 10 random points, and for each one sample 10 random neighbors (within some distance) to average and ratio with the original point.

b) To find interesting parameter images, if c is the pixel determining bit and d is the remaining parameters, start with a random d point and sample c to compute an interestingness logarithm. Pick some neighbors in d-space and choose the one with largest interestingness modulus. Pick neighbors of that, etc., and automatedly hill-climb to a high interestingness d value. Then plot the c plane image for that d.

Mind you, this might go for c plane images that are simply very noisy. If there's an interestingness logarithm "sweet spot" you might want the algorithm to warmer-colder toward this value. Or just plot a c plane image for every point along a hill climb: one of them is likely to be genuinely interesting (and its logarithm is a candidate "sweet spot" value).

#### Etymos

• Fractal Fanatic
• Posts: 26
• deep skyey voids above

#### Re: King's Dream Fractal - Investigation

« Reply #24 on: September 01, 2018, 04:19:32 PM »
Wow, great suggestions! Thank you very much for your thoughts on this!

Mind you, this might go for c plane images that are simply very noisy.

Hmm, yeah. Since a set of parameters with a chaotic attractor likely causes fast separation of nearby points to everywhere in the attractor the map of attraction will just be noise (there are no real basins of attraction), which might deceive into thinking you've hit a complicated boundary. Maybe employing Lyapunov exponents into the algorithm could sift out the random attractors with their completely noisy maps of attraction? (Then again there might be cases where multiple chaotic attractors fight over the starting points in a complicated fashion...)

#### Etymos

• Fractal Fanatic
• Posts: 26
• deep skyey voids above

#### Map of attraction and interesting-ness

« Reply #25 on: September 02, 2018, 09:43:06 PM »
A dirty implementation of paudelbrot's proposed algorithm below (checks one random set of parameters after another):

Code: [Select]
float a, b, c, d, x, y, xp, yp, xs, ys, temp;PFont f;int t = 0, temp2;void setup() {  size(500, 500);  f = createFont("Arial", 16, true);  colorMode(HSB, 100);}void draw() {    background(0);    a = random(-4, 4); b = random(-4, 4); c = random(-4, 4); d = random(-4, 4);    temp = interest();    t = 0;       for (int px = 0; px < width; px++) {      for (int py = 0; py < height; py++) {    xs = map(px, 0, width, -5, 5);    ys = map(py, 0, height, -5, 5);    xp = xs;    yp = ys;    for (int i = 0; i < 50; i++) {      x = sin(yp * b) + c * sin(xp * b);      y = sin(xp * a) + d * sin(yp * a);             xp = x;      yp = y;    }    set(px, py, getit(x, y, 10, 10));    }  }  println("a = " + str(a) + "; b = " + str(b) + "; c = " + str(c) + "; d = " + str(d) + "; // P = " + str(temp));}float interest() {  float p[][][] = new float[10][10][2];  float p2[][] = new float[8][8];    for (int i = 0; i < 10; i++) {    for (int j = 0; j < 10; j++) {      xp = map(i, 0, 9, -0.5, 0.5);         yp = map(j, 0, 9, -0.5, 0.5);         for (int k = 0; k < 500; k++) {        x = sin(yp * b) + c * sin(xp * b);        y = sin(xp * a) + d * sin(yp * a);         xp = x;        yp = y;      }      p[i][j][0] = x;      p[i][j][1] = y;    }  }  float sumx;  float sumy;  for (int i = 1; i < 9; i++) {    for (int j = 1; j < 9; j++) {      sumx = 0;      sumy = 0;      for (int i2 = -1; i2 <= 1; i2++) {        for (int j2 = -1; j2 <= 1; j2++) {          if (i2 != 0 && j2 != 0) {sumx += p[i+i2][j+j2][0]; sumy += p[i+i2][j+j2][1];}        }      }      p2[i - 1][j - 1] = sqrt(sq(p[i][j][0] - sumx) + sq(p[i][j][1] - sumy));    }  }    float av = 0;    for (int i = 0; i < 8; i++) {    for (int j = 0; j < 8; j++) {      av += p2[i][j];    }  }  //println(av/64);  return av/64; }color getit(float x_, float y_, float w, float h) {  return color((atan(-(y_ - h/2)/(x_ - w/2)) * 31.415 + 50) * 10 % 100, 400 * sqrt(sq(y_ - h/2) + sq(x_ - w/2)) / sqrt(w*h), 100);}
Instead of dividing by the average of the neighbouring points I simply took a distance function (mostly because I wasn't sure how to correctly divide points). A 10x10 grid is sampled in the x-y-space of -0.5 to 0.5.

Then I just made a huge list of maps of attraction; but I was lazy and wrote an unconstrained version which doesn't care about cycles at all, but instead the position of the point after the iteration.

Here is the code for that (although it is part of the code above):

Code: [Select]
float a, b, c, d, x, y, xp, yp, xs, ys, temp;PFont f;int t = 0, temp2;void setup() {  size(500, 500);  f = createFont("Arial", 16, true);  //a = 0.860415; b = -2.337327; c = -0.016195297; d = 1.3201079; // P = 2.3640182 //krass    colorMode(HSB, 100);  background(0);      for (int px = 0; px < width; px++) {      for (int py = 0; py < height; py++) {    xs = map(px, 0, width, -5, 5);    ys = map(py, 0, height, -5, 5);    xp = xs;    yp = ys;    for (int i = 0; i < 50; i++) {      x = sin(yp * b) + c * sin(xp * b);      y = sin(xp * a) + d * sin(yp * a);             xp = x;      yp = y;    }    set(px, py, getit(x, y, 10, 10));    }  }  println("a = " + str(a) + "; b = " + str(b) + "; c = " + str(c) + "; d = " + str(d));}void draw() {    }color getit(float x_, float y_, float w, float h) {  return color((atan(-(y_ - h/2)/(x_ - w/2)) * 31.415 + 50) * 10 % 100, 400 * sqrt(sq(y_ - h/2) + sq(x_ - w/2)) / sqrt(w*h), 100);}
The list I made showed that low values had either blank maps of attraction or interesting ones, but sometimes with noise in between (0.0 - 2.0 circa) and higher values (about 2.0 - 7.0, but mostly 4.0 - 6.0) were mostly noise. But sometimes there were some interesting ones even in this high range! This shows to me that the funtion for the values still needs to be optimised.

I figured that noise is not that interesting to look at, so here are some cherry-picked ones with a range of interestingness values (I call it P for now).

a = 0.45221663; b = -2.7604642; c = -0.710444; d = -1.3897924; // P = 0.43269658
a = -2.244555; b = 1.5072684; c = 1.2576766; d = 1.0405989; // P = 0.5516912
a = -2.7047129; b = 0.6918626; c = 1.7450433; d = 0.23407888; // P = 1.4036119
a = 1.1713247; b = -0.7425852; c = 1.1708984; d = -1.3589964; // P = 3.4723818
a = 0.8547025; b = 0.7852287; c = -1.5982718; d = -2.5269532; // P = 7.172738

• 3d
• Posts: 986

#### Re: King's Dream Fractal - Investigation

« Reply #26 on: September 04, 2018, 01:41:54 AM »
Quote
I'd consider intricate boundaries interesting, but how can we put this into numbers
fractal dimension? https://mathr.co.uk/mandelbrot/julia-dim.pdf

#### vasyan

• Fractal Fanatic
• Posts: 20

#### Re: King's Dream Fractal - Investigation

« Reply #27 on: November 10, 2018, 07:19:02 PM »

In this case the following set of parameters was used:
Example 1: a = 1.0, b = 1.5, c = 1.557, d = -1.0

Hello Etymos!
I tried to use Clifford attractor with parameters a = 1.0, b = 1.5, c = 1.557, d = -1.0 as it is specified in your post, but I received absolutely other result. Maybe something is cunning in your code which makes other image?

#### vasyan

• Fractal Fanatic
• Posts: 20

#### Re: King's Dream Fractal - Investigation

« Reply #28 on: November 10, 2018, 09:09:58 PM »

Below is an example of this. First the coloring scheme is shown, then the actual map.

From the previous message I dealt with a problem.
Interests as you maded a actual map?

#### Etymos

• Fractal Fanatic
• Posts: 26
• deep skyey voids above

#### Re: King's Dream Fractal - Investigation

« Reply #29 on: December 06, 2018, 08:47:22 PM »
Hello Etymos!
I tried to use Clifford attractor with parameters a = 1.0, b = 1.5, c = 1.557, d = -1.0 as it is specified in your post, but I received absolutely other result. Maybe something is cunning in your code which makes other image?

Oh, I'm sorry for that late answer! Well it seems like the clifford attractor has the formula

xn+1 = sin(a yn) + c cos(a xn)
yn+1 = sin(b xn) + d cos(b yn)

where as King's Dream has

xn+1 = sin(b yn) + c sin(b xn)
yn+1 = sin(a xn) + d sin(a yn)

so there is not set of parameters that would make them equivalent.

From the previous message I dealt with a problem.
Interests as you maded a actual map?

The processing code I have given there works:

Code: [Select]
float a, b, c, d, x, y, xp, yp, xs, ys;PFont f;void setup() {  size(800, 800);  f = createFont("Arial", 16, true);  a = 1.0; //parameters  b = 1.5;  c = 1.557;  d = -1.0;  background(0);}void draw() {  //delay(100);  background(0);  for (int px = 0; px < width; px += 1) {    for (int py = 0; py < height; py += 1) {      xs = map(px, 0, width, -5, 5);      ys = map(py, 0, height, -5, 5);      xp = xs;      yp = ys;      for (int i = 0; i < 30; i++) {        x = sin(yp * b) + c * sin(xp * b);        y = sin(xp * a) + d * sin(yp * a);        xp = x;        yp = y;      }      if (xp < yp / -4) {set(px, height-py, color(255));}      println(px + " " + py);    }  }   fill(255, 0, 0);  noStroke();  textFont(f, 16);  text("a = " + str(a) + "\nb = " + str(b) + "\nc = " + str(c) + "\nd = " + str(d), 10, 30);}
First, the iteration is performed a set number of times for each point of the plane. Each of those new points is then checked with the line
if (xp < yp / -4) {set(px, height-py, color(255));}
which divides the screen in two halfs. If the points lands on one, it's white, if it's on the other, it's black.

### Similar Topics

###### King's Dream Fractal

Started by Etymos on Fractal Image Gallery

0 Replies
94 Views
August 17, 2018, 10:07:31 PM
by Etymos
###### King's Dream Fractal - Lyapunov maps

Started by Etymos on Fractal Image Gallery

1 Replies
87 Views
September 09, 2018, 07:06:04 PM
by Dinkydau
###### Tripping Eye - Psychedelic Deep Dream Fractal Journey - Full HD

Started by schizo on Fractal movie gallery

0 Replies
392 Views
September 09, 2017, 11:43:06 PM
by schizo
###### Castle of the Pumpkin King

Started by Paigan0 on Fractal Image Gallery

0 Replies
126 Views
October 27, 2017, 10:01:23 PM
by Paigan0
###### Purple Dream

Started by kohlenstoff on Fractal Image Gallery

0 Replies
46 Views
October 24, 2018, 11:15:38 PM
by kohlenstoff