### Lyapunov example

• 14 Replies
• 584 Views

0 Members and 1 Guest are viewing this topic.

• 3f
• Posts: 1272

#### Lyapunov example

« on: October 12, 2018, 02:09:35 AM »
I coded it.  Very simple.  Feel free to include in the FragM distribution under FragM's license.

Supports control strings up to 16 bits, encoded in little-endian binary (so BBBBBBAAAAAA for ZIrcon Zity becomes Length 12 String 4032).

• 3f
• Posts: 1840

#### Re: Lyapunov example

« Reply #1 on: October 12, 2018, 04:58:50 AM »
I find it somewhat interesting that a random string seems to give a unique result for sufficiently long warmup cycle.

• 3f
• Posts: 1402

#### Re: Lyapunov example

« Reply #2 on: October 12, 2018, 05:23:17 AM »
looks nice! haven't tried yet but I bet it's faaaaast!

this is one of the  routines from my very first factal proggie that I've been meaning to convert to a frag...

old enough to use 8bit  (circa 2001)

Code: [Select]
/* A function derived from the basic formula used for making "Feigenbaum trees". * The Lyapunov  exponent is calculated * * FOR I=1 TO ITERATIONS *     X=RX(1-X) *     L=L+LOG(ABS(R-2RX))/LOG(2) * NEXT I * L=L/ITERATIONS * * This version uses Y inplace of R and swaps X and Y insead of * replacing R with X or Y. Using the defaults does this every * 2nd and 3rd of 8th iteration  until the Lyapunov exponent exceeds 1. * The swapping is controlled via MaxVal turned into an eight bit * 0 = noswap 1 = swap rule. It is tested and shifted right by one. * If the 0th bit was a one then the 7th bit is set and XY are * swapped and we iterate, if it was a 0 then just shift and iterate. * * The "1" in the X calc is replaced with real constant "recon" * The "2" in the L calc is replaced with imaginary constant "imcon" * * The rules * * decimal integer 170 = binary rule 10101010 *                   6 = binary rule 00000110 */void QtfPainter::lyapunfunc( double r, double i){  uint count = 0;  double p=r;  double q=i;  double a = 0;  short nbit = (short)(170);    while ( count++ < maxiter)    {      if( nbit & 0x01 ) {           p=r;q=i;           nbit = ( nbit >> 1 );           nbit |= 128;      }      else {           q=r;p=i;           nbit = ( nbit >> 1 );      }      r=p*q*(recon-q);      i=log(fabs(p-imcon*p*q))/log(2);      a += i/maxiter;      if(fabs(a) > 1) break;    }  coltmp = (count >= maxiter) ? 0 : ( count % maxcol + 2 );return;}
p,q,a temporaries
coltmp global color var

r,i,recon,imcon same vars I was using for mand/julia stuff
Fragmentarium is not a toy, it is a very versatile tool that can be used to make toys

https://en.wikibooks.org/wiki/Fractals/fragmentarium

• 3f
• Posts: 1272

#### Re: Lyapunov example

« Reply #3 on: October 12, 2018, 05:58:40 AM »
I find it somewhat interesting that a random string seems to give a unique result for sufficiently long warmup cycle.

you mean different random strings give the same result on average?  perhaps is similar phenomenon to "the random graph"?

• 3f
• Posts: 1840

#### Re: Lyapunov example

« Reply #4 on: October 12, 2018, 06:04:07 AM »
you mean different random strings give the same result on average?  perhaps is similar phenomenon to "the random graph"?
Not on average but "always". I think the probability of hitting a "non-random" string goes to zero.
Maybe if you generate strings with different Kolmogorov complexities X (not sure how, how much it is compressible is a good heuristic measure) you'll find the picture depends on X.

• 3f
• Posts: 1272

#### Re: Lyapunov example

« Reply #5 on: October 12, 2018, 06:10:03 AM »
https://en.wikipedia.org/wiki/Normal_number this is probably the real reason, forget the random graph

• 3f
• Posts: 1840

#### Re: Lyapunov example

« Reply #6 on: October 12, 2018, 06:16:57 AM »
Yes, random numbers are normal. This is why my $$\pi$$ Lyap set I posted a while ago looks just like the random ones (not quite as I took a window of digits and recycled them). Another measure of randomness is just information theoretic entropy.
I'm going to play around with this a bit.

• 3f
• Posts: 1272

#### Re: Lyapunov example

« Reply #7 on: October 12, 2018, 07:03:03 AM »
Working on a 3D variant, based on alternating between 2 different C values for the regular 2D Mandelbrot set iterations and using its distance estimate.  The system is 4D, so it needs slicing somehow.  Currently I'm playing with a 3+1D animation, but it could be nice to have a 4D raytracer (allowing true 4D lighting instead of 3D lighting of a slice).  I played a bit with this on CPU in the past, it's mostly quite straightforward translation of vector maths from 3D to 4D (cross product takes takes 3 vectors as input, is the main difference).

• 3f
• Posts: 1272

#### Re: Lyapunov example

« Reply #8 on: October 12, 2018, 04:30:19 PM »
some images, a bit whipped cream filaments...

• 3f
• Posts: 1272

#### Re: Lyapunov example

« Reply #9 on: October 12, 2018, 04:31:37 PM »
2 more and the source... has some duplication/hardcoded things for an animation that I won't render as it'll take too long...

• 3f
• Posts: 1840

#### Re: Lyapunov example

« Reply #10 on: October 12, 2018, 06:02:29 PM »
Nice, they look like drawings of muscles from anatomy books.

#### Sabine62

• Fractal Freak
• Posts: 661

#### Re: Lyapunov example

« Reply #11 on: October 12, 2018, 10:06:39 PM »
Thank you very much for this, claude!

Have changed the environment for own use, attached whole frag, though will also run with soft-raytracer of course
To thine own self be true

• 3f
• Posts: 1402

#### Re: Lyapunov example

« Reply #12 on: October 13, 2018, 02:08:09 AM »
Beautiful renders Sabine, as always
Nice work claude

• 3f
• Posts: 1840

#### Re: Lyapunov example

« Reply #13 on: October 13, 2018, 04:48:38 AM »
I find it somewhat interesting that a random string seems to give a unique result for sufficiently long warmup cycle.
It's not so. I made the beginners mistake of use rand%2 to generate random 0/1s.

• 3f
• Posts: 1272

#### Re: Lyapunov example

« Reply #14 on: October 13, 2018, 03:37:32 PM »
GNU Scientific Library (GSL) is where I go to if I need high quality PRNG: https://www.gnu.org/software/gsl/doc/html/rng.html

Multithreading / determinism is another issue.  For GPU I use a uint hash of pixel coordinates (etc), not very high quality but better than the fract/sin alternatives: http://www.burtleburtle.net/bob/hash/integer.html

### Similar Topics

###### Lyapunov fractals

Started by ThunderboltPagoda on Image Threads

160 Replies
15145 Views
August 13, 2019, 12:15:41 PM
by vasyan
###### Lyapunov Pagoda

41 Replies
1151 Views
November 07, 2019, 11:39:09 PM
by ThunderboltPagoda
###### Lyapunov diagrams

Started by marcm200 on Image Threads

79 Replies
3364 Views
February 25, 2019, 11:09:36 AM
by marcm200