Lyapunov example

  • 14 Replies
  • 313 Views

0 Members and 1 Guest are viewing this topic.

Offline claude

  • *
  • 3d
  • ****
  • Posts: 972
    • mathr.co.uk
« 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).

Offline gerrit

  • *
  • 3f
  • ******
  • Posts: 1545
« 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.

Offline 3DickUlus

  • *
  • 3e
  • *****
  • Posts: 1041
    • Digilantism
« 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  :tease: (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
Resistance is fertile... you will be illuminated!

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

Offline claude

  • *
  • 3d
  • ****
  • Posts: 972
    • mathr.co.uk
« 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"?

Offline gerrit

  • *
  • 3f
  • ******
  • Posts: 1545
« 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.

Offline claude

  • *
  • 3d
  • ****
  • Posts: 972
    • mathr.co.uk
« 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

Offline gerrit

  • *
  • 3f
  • ******
  • Posts: 1545
« 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.

Offline claude

  • *
  • 3d
  • ****
  • Posts: 972
    • mathr.co.uk
« 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).

Offline claude

  • *
  • 3d
  • ****
  • Posts: 972
    • mathr.co.uk
« Reply #8 on: October 12, 2018, 04:30:19 PM »
some images, a bit whipped cream filaments...

Offline claude

  • *
  • 3d
  • ****
  • Posts: 972
    • mathr.co.uk
« 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...

Offline gerrit

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

Offline Sabine62

  • *
  • Fractal Frankfurter
  • *
  • Posts: 563
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #11 on: October 12, 2018, 10:06:39 PM »
Thank you very much for this, claude! :thumbs:


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

Offline 3DickUlus

  • *
  • 3e
  • *****
  • Posts: 1041
    • Digilantism
« Reply #12 on: October 13, 2018, 02:08:09 AM »
Beautiful renders Sabine, as always  :thumbs:
Nice work claude  :clapping: :worship:

Offline gerrit

  • *
  • 3f
  • ******
  • Posts: 1545
« 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.

Offline claude

  • *
  • 3d
  • ****
  • Posts: 972
    • mathr.co.uk
« 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


clip
Lyapunov diagrams

Started by marcm200 on Image Threads

79 Replies
2537 Views
Last post February 25, 2019, 11:09:36 AM
by marcm200
clip
Lyapunov fractals

Started by ThunderboltPagoda on Image Threads

154 Replies
8441 Views
Last post March 07, 2019, 02:49:47 PM
by marcm200
xx
Precision in Lyapunov images?

Started by marcm200 on Programming

1 Replies
104 Views
Last post January 30, 2019, 04:31:30 PM
by claude
clip
Three dimensional Lyapunov space

Started by marcm200 on Image Threads

30 Replies
735 Views
Last post March 17, 2019, 09:43:54 AM
by marcm200
xx
GIMPed Lyapunov Inversion

Started by Kalter Rauch on Fractal Image Gallery

3 Replies
122 Views
Last post July 14, 2018, 09:57:23 PM
by Kalter Rauch