Help with Indra's Pearls by David Mumford, Caroline Series and David Wright

  • 13 Replies
  • 265 Views

0 Members and 1 Guest are viewing this topic.

Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« on: April 12, 2019, 04:21:37 PM »
I'm not sure if this is the right place for this topic, if I need to start this thread in another part of the forum, please correct me.

I broke down and bought the book "Indra's Pearls"  :)

I could only afford the Kindle version, but it is the full book, and I'm working hard to follow/understand it, but have questions and don't know where else to ask.

I love math, but don't have the formal education to figure out how to use the book. I am an experienced graphics programmer, and have written both fractal software and 3D ray-tracers from scratch, and combined both for a 3D volumetric IFS Apophysis type renderer.

https://www.deviantart.com/casteeld/art/Render-1178505789600-jpg-54824372

https://www.deviantart.com/casteeld/art/Crosseyed005-JPG-54731480

I'd love to start a discussion that will not only help me, but others who may be in the same situation.

I've attached a screenshot of a double spiral, and here is my first attempt at a Mobius transform class

Code: [Select]
    public partial class MobiusMatrix
    {
        // find mobius components
        // http://klein.math.okstate.edu/cgi-bin/TwoGenerator.cgi

        Complex a, b, c, d, D;
       
        public MobiusMatrix(Complex _a, Complex _b, Complex _c, Complex _d)
        {
            a = _a;
            b = _b;
            c = _c;
            d = _d;
            D = a * d - b * c;
        }

        public Complex Transform(Complex z)
        {
            return Complex.Divide(z * a + b, z * c + d);
        }

        public Complex InverseTransform(Complex z)
        {
            MobiusMatrix I = new MobiusMatrix(
                d / D, -b / D,
                -c / D, a / D
                );
            return I.Transform(z);
                //Complex.Divide(z * d - b, -z * c + a);
        }

    }



Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« Reply #1 on: April 12, 2019, 07:40:17 PM »
This is where I'm stuck...
I'm trying to implement this transform:
         
Which is supposed to generate this curve:
         

Here's the code I've tried, but while it compiles and runs without errors, the plotted lines don't make the pattern above. Notice I've tried one syntax for Z1 and a "no-operators" attempt for Z2. Neither end of the iterated lines follow the expected pattern? (screen shot below the code)

Code: [Select]
            p1 = new Point(seed, 0.0);
            p2 = new Point(seed+1.0, 0.0);

            Complex Z1;
            Complex Z2;

            for (int i = 0; i < 60000; i++)
            {
                //p2 = p1;
                Z1 = new Complex(p1.X,p1.Y);
                Z1 = Complex.Divide(1.0, -(2.0 * ONEI) * Z1 + 1.0);
                Z1 = Complex.Divide((ONE - ONEI) * Z1 + 1.0, Z1 + 1.0 + ONEI);
                p1.X = Z1.Real;
                p1.Y = Z1.Imaginary;

                Z2 = new Complex(p2.X, p2.Y);
                Z2 = Complex.Divide
                    (
                        ONE,
                        Complex.Multiply
                            (
                                -(
                                Complex.Multiply
                                    (
                                    new Complex(2.0,0.0),
                                    ONEI
                                    )
                                ),
                                Complex.Add(Z2,ONE)
                            )
                    );
                Z2 = Complex.Divide
                        (
                        Complex.Add
                            (
                            Complex.Multiply
                                (
                                Complex.Subtract(ONE, ONEI),
                                Z2
                                ),
                            ONE
                            ),
                        Complex.Add
                            (
                            Z2,
                            Complex.Add
                                (
                                ONE,
                                ONEI
                                )
                            )
                        );
                p2.X = Z2.Real;
                p2.Y = Z2.Imaginary;

                //if (
                //    double.IsNaN(p1.X) ||
                //    double.IsNaN(p1.Y) ||
                //    double.IsNaN(p2.X) ||
                //    double.IsNaN(p2.Y)
                //    ) break;
                Point cp1 = toCanvas(p1);
                Point cp2 = toCanvas(p2);
                Line line = new Line();
                line.Stroke = Brushes.Red;
                line.StrokeThickness = LineThickness;
                line.X1 = cp1.X;
                line.Y1 = cp1.Y;
                line.X2 = cp2.X;
                line.Y2 = cp2.Y;
                DrawCanvas.Children.Add(line);
            }



Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« Reply #2 on: April 12, 2019, 07:57:57 PM »
As for the book (Indra's Pearls) and most or all on-line information... what confuses me is they show us a mobius transform has this matrix form



or



Where a,b,c,d are all complex numbers (Z as well) however like the formula in my previous post, they don't implement the transforms as matrices, I realize they've been simplified, but reversing back to matrices is not explained. While this is fine for a single implementation of a specific formula, when trying to develop software that can be used for any mobius transform it just makes everything more confusing?

This makes creating classes like the MobiusMatrix in my first post unusable and therefore impossible to test and debug against the examples.

Offline claude

  • *
  • 3e
  • *****
  • Posts: 1004
    • mathr.co.uk
« Reply #3 on: April 12, 2019, 11:18:51 PM »
Neither end of the iterated lines follow the expected pattern?

I haven't got the book (may have a PDF somewhere, but not on this computer), but I think the curve is a limit set of all possible combinations of the two transformations (and possibly their inverses too).  One way of plotting this is the chaos game, where you start with one point and randomly choose one of the transformations each step, plotting all the points you pass through on the orbit.  But this can lead to uneven images, as some parts of the set are visited more often.  I think a lot of the book is about plotting the limit sets more efficiently, but better to have something working first.
« Last Edit: April 12, 2019, 11:33:42 PM by claude, Reason: inverses »

Offline claude

  • *
  • 3e
  • *****
  • Posts: 1004
    • mathr.co.uk
« Reply #4 on: April 12, 2019, 11:30:07 PM »
makes everything more confusing?
I've heard this criticism of the book before.  Impressive results, but not explained detailed enough step by step.

As for Moebius transformations and matrices, the connection is function composition: if y = (a x + b) / (c x + d) and z = (e y + f) / (g y + h) then the matrix of z(x) is the matrix (e, f ; g, h) * (a, b ; c, d) = (ea+fc , eb+fd ; ga+hc , gb+hd).  Also the matrix inverse is the Moebius transformation inverse.

Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« Reply #5 on: April 13, 2019, 12:03:40 AM »
One way of plotting this is the chaos game

I hadn't tried that yet, only because the diagram here shows a stick figure mapped along the curve



This is the webpage
Code: [Select]
https://plus.maths.org/content/non-euclidean-geometry-and-indras-pearls
There are similar examples in the book

Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« Reply #6 on: April 13, 2019, 03:27:32 PM »
I've heard this criticism of the book before.  Impressive results, but not explained detailed enough step by step.

As for Moebius transformations and matrices, the connection is function composition: if y = (a x + b) / (c x + d) and z = (e y + f) / (g y + h) then the matrix of z(x) is the matrix (e, f ; g, h) * (a, b ; c, d) = (ea+fc , eb+fd ; ga+hc , gb+hd).  Also the matrix inverse is the Moebius transformation inverse.

I wasn't ignoring this quote but didn't want to reply until I had time to read it closely.

I agree the problem with the book so far is lack of details and explanations, also the constant changing of subject matter before any concept is followed all the way through. Several times I've gotten my head wrapped around some of it, then what comes next is a completely confusing until I realize it's something not (directly) related to what we were working on.

I've not worked through your Mobius explanation, but will start dissecting it in a few minutes.

Thank you so much... I really appreciate this kind of help  :thumbs:

Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« Reply #7 on: April 13, 2019, 03:41:32 PM »
Excel files won't upload here, but here is a screenshot of a workbook I put together for creating double spirals and withe the slider on the left I can animate the curves by moving the starting point toward or away from the origin.

If anyone can use it, just let me know.

Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« Reply #8 on: April 14, 2019, 01:55:58 PM »
Grandma's Recipe in C# (WPF)

Here's my best attempt, in particular are "A","B", and "C" just inverse's as I've done?

I'd appreciate any suggestions/corrections?

Code: [Select]
    public partial class GrandmasFormula
    {
        public Complex TA;
        public Complex TB;
        public Complex I = new Complex(0.0, 1);
        public MobiusMatrix a, b, c, A, B, C;
        public GrandmasFormula(Complex ita, Complex itb)
        {
            TA = ita;
            TB = itb;

            Complex ta = .5 * TA + 1 - I;
            //ta = 1.64213876 +i*0.76658841;
            Complex tb = .5 * TB + 1 - I;



            //Grandma's recipe from Indra's Pearls: The Vision of Felix Klein, David Mumford, ‎Caroline Series, ‎David Wright
            Complex tab = ta * tb / 2 - I * Complex.Sqrt(-((ta * tb / 2.0) * (ta * tb / 2.0) - ta * ta - tb * tb));
            Complex z0 = ((tab - 2) * tb) / (tb * tab - 2 * ta + 2 * I * tab);
            a = new MobiusMatrix
                (
                    ta / 2.0,
                    (ta * tab - 2 * tb + 4 * I) / ((2 * tab + 4) * z0),
                    (ta * tab - 2 * tb - 4 * I) * z0 / (2 * tab - 4),
                    ta / 2
                );


            b = new MobiusMatrix
                (
                    (tb - 2 * I) / 2, tb / 2,
                    tb / 2, (tb + 2 * I) / 2
                );


            A = a.GetInverse();
            B = b.GetInverse();

            c = a * b * A;
            C = c.GetInverse();
        }
    }

And here is the Mobius class:
Code: [Select]
    public partial class MobiusMatrix
    {
        public Complex a, b, c, d, D;
        public Complex[,] M;
        public MobiusMatrix(Complex _a, Complex _b, Complex _c, Complex _d)
        {
            a = _a;
            b = _b;
            c = _c;
            d = _d;
            D = a * d - b * c;
            M = new Complex[2, 2] { { _a, _b }, { _c, _d } };
        }
        public MobiusMatrix GetInverse()
        {
            return new MobiusMatrix(
                d / D, -b / D,
                -c / D, a / D
                );
        }
        public Complex Transform(Complex z)
        {
            return Complex.Divide(z * a + b, z * c + d);
        }
        public static MobiusMatrix operator *(MobiusMatrix x, MobiusMatrix y)
        {
            return new MobiusMatrix(x.M[0, 0] * y.M[0, 0], x.M[1, 0] * y.M[0, 1], x.M[0, 1] * y.M[1, 0], x.M[1, 1] * y.M[1, 1]);
        }
    }
« Last Edit: April 14, 2019, 02:12:45 PM by Don Casteel »

Offline claude

  • *
  • 3e
  • *****
  • Posts: 1004
    • mathr.co.uk
« Reply #9 on: April 14, 2019, 06:46:22 PM »
I'd appreciate any suggestions/corrections?

Code: [Select]
        public MobiusMatrix GetInverse()
        {
            return new MobiusMatrix(
                d / D, -b / D,
                -c / D, a / D
                );
        }
Not 100% sure but this may be transposed?  Should b and c be swapped?

Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« Reply #10 on: April 14, 2019, 11:04:01 PM »
Not 100% sure but this may be transposed?  Should b and c be swapped?

I don't know myself, but I'll give it a try  :thumbs:

Offline Don Casteel

  • *
  • Fractal Freshman
  • *
  • Posts: 9
« Reply #11 on: April 14, 2019, 11:11:29 PM »
I don't know myself, but I'll give it a try  :thumbs:

LOL... I still don't know, I swapped b and c but the results are still wrong, I just can't figure out how to actually use the transformations

Offline xenodreambuie

  • *
  • Fractal Friend
  • **
  • Posts: 16
« Reply #12 on: April 17, 2019, 12:28:25 PM »
I don't have the book, but I thought Grandma's Recipe took 3 complex traces as input and produced transformations a,b and inverses A,B. Any other transformations are temporary variables. Then you produce lots of combinations of those four, by whichever method you are using, and plot the results.

Offline Zueuk

  • *
  • Fractal Freshman
  • *
  • Posts: 1
« Reply #13 on: Yesterday at 12:14:07 AM »
What I really hated about this book is how they obfuscate everything by this ridiculous baby-talk ("grandma recipes"?? WTF!?) and by mashing together several different things, like rendering the image with known parameters and finding the parameters themselves.

No, really - in the text we suddenly encounter something like
Code: [Select]
ta = 1.64213876 + i*0.76658841;what? where from?? how did we get this number???
(trying to read further, see another 50 pages of explaining complex numbers to 5 graders)
. . .
(find another mention of the "grandma", brain goes BOOOOOM :fp:)

One thing you could do to try understanding what's going on is to use any IFS software (ie. Apophysis) to generate these.

Moebius generators used in the book are somewhat overcomplicated (which is of course never explained, at least in a normal non-babytalk way), in reality you can get these patterns much easier - Apophysis users stumble into them by accident all the time.

For example, you could use
Code: [Select]
   1
-------
 z + iY
where Y = 2cos(pi/N), or just use 1, that is 2cos(pi/3)

and
Code: [Select]
   1
-------
-z + C
where C = the mysterious parameter that you can tweak manually (Apo) or calculate via polynomials.
Can start from 2cos(pi/N) here too.

Both these Moebius TFs are inversion(translation(rotation(z))) which is quite easy to do in Apo using built-in functions - that is without using the (ugly) Mobius plugin.


xx
An Interview with David Makin

Started by 1Maniac on Mandelbulb Maniacs

0 Replies
257 Views
Last post September 09, 2017, 04:47:22 PM
by 1Maniac
xx
Pearls

Started by Frakkie on Fractal Image Gallery

0 Replies
58 Views
Last post October 13, 2018, 10:13:44 PM
by Frakkie
clip
Pearls - Pseudo Kleinian 3D Fractal

Started by Alon Nahary on Fractal movie gallery

3 Replies
112 Views
Last post August 20, 2018, 08:54:44 PM
by Alon Nahary
xx
Eclipse Series #3

Started by Holocene on Fractal Image Gallery

0 Replies
84 Views
Last post March 16, 2018, 12:38:59 AM
by Holocene
xx
Bubble Tree Series #68

Started by Ventrella on Fractal Image Gallery

0 Replies
50 Views
Last post November 04, 2018, 09:46:13 PM
by Ventrella