• March 02, 2021, 05:05:49 PM

Login with username, password and session length

Author Topic: (Question) Actual Implementation of Perturbation Theory for the Mandelbrot Set  (Read 1099 times)

0 Members and 1 Guest are viewing this topic.

Offline LionHeart

  • Uploader
  • *
  • Posts: 164
    • ManpWIN Fractal Generator
(Question) Actual Implementation of Perturbation Theory for the Mandelbrot Set
« on: February 18, 2019, 06:31:38 AM »
Hi Friends,

This is my first post on the new forum. I am trying to implement perturbation theory from SUPERFRACTALTHING MATHS by K.I. MARTIN. I couldn't really understand it but then found Shirom Makkad's MandelbrotPerturbation program on GitHub.

https://github.com/ShiromMakkad/MandelbrotPerturbation

When I ran it, it certainly gave the sort of speed enhancement I get from Kalles Fraktaler, but seems to be plagued by glitches.



Does anyone have any experience with this program?

I suspect the precision is lost in the step:

      xZoomPoint = atof(xZoomPointin);
      yZoomPoint = atof(yZoomPointin);

where these variables are long doubles (64bits in Microsoft VC++). But I don't really understand perturbation theory very well.

Actually, what I really want is a library source that is platform independent that looks like:

int  MandelbrotPerturbation(int ScreenWidth, int ScreenHeight, long MaxIterations, char *xZoomPt, char *yZoomPt, double ZoomWidth, long*PixelArray)

where:
image size is given by ScreenWidth and ScreenHeight
Maximum number of iterations tested = MaxIterations
xZoomPt, yZoomPt are strings containing the full number of digits for the centre (or corner) of the complex plane
ZoomWidth is the vertical size of the area is the complex plane
PixelArray is an array of all pixels and their iteration count

Any help here would be greatly appreciated
Thanks.



Linkback: https://fractalforums.org/fractal-mathematics-and-new-theories/28/actual-implementation-of-perturbation-theory-for-the-mandelbrot-set/2631/
Paul the LionHeart

Offline quaz0r

  • Fractal Feline
  • **
  • Posts: 152
Re: Actual Implementation of Perturbation Theory for the Mandelbrot Set
« Reply #1 on: February 19, 2019, 10:56:43 AM »
I've never heard of that program nor seen it mentioned anywhere on the forum here.  Unless someone is an active participant in the discussions here and/or has pored over the years' worth of discussions here they probably will come up with a very basic, unoptimized, inaccurate, janky, buggy, unreliable implementation at best, as evidenced by your description of it and your example image of what should be the easiest sort of location to get right.

most people don't have the time nor want to spend the time it would really take to totally get all the ins and outs of making these things work properly and efficiently.  many a nerd has fancied themselves clever by writing a z^2+c "program" in a couple days or a day or 5 minutes or whatever, but this other stuff is not at all a linear increase in difficulty or complexity.

Offline 3DickUlus

  • Administrator
  • *******
  • Posts: 2055
    • Digilantism
Re: Actual Implementation of Perturbation Theory for the Mandelbrot Set
« Reply #2 on: February 19, 2019, 03:34:20 PM »
http://www.superfractalthing.co.nf/sft_maths.pdf
http://sourceforge.net/projects/suprfractalthng/
http://www.fractalforums.com/announcements-and-news/superfractalthing-arbitrary-precision-mandelbrot-set-rendering-in-java/

immediate 10x speed increase = port from java to C

deep deep zooms = kalles fraktaler

there are a number of "actual" implementations but the trick is fixing the glitches generated by shortfalls... good luck :D

Offline claude

  • 3f
  • ******
  • Posts: 1787
    • mathr.co.uk
Re: Actual Implementation of Perturbation Theory for the Mandelbrot Set
« Reply #3 on: February 19, 2019, 03:58:23 PM »
that glitch looks something like what happens if you have the reference orbit out of position relative to the pixels positions in a glitch correction pass (for example, by initializing pixel deltas relative to image center instead of relative to reference C).

http://www.fractalforums.com/announcements-and-news/pertubation-theory-glitches-improvement/ is the key post about glitch detection

I was working on such a library at one point but KF is more powerful and I didn't manage to fix my own code's glitch correction satisfactorily yet (EDIT: code actually does work with minor changes, was just left in an experimental non-working state last time I touched it several years ago).  KF does some image-space processing to find the center of glitches, I'm not entirely sure how it works.  Then KF adds a new reference at the center of the largest glitch and rerenders glitched pixels, until remaining glitches are insignificant.

https://code.mathr.co.uk/mandelbrot-perturbator/blob/eecab5441ecae8a6179b19164cf504672c924e23:/c/include/mandelbrot-perturbator.h is the API of my library, it does calculations in separate threads for ease of writing GUIs without blocking everything.
« Last Edit: February 19, 2019, 05:14:05 PM by claude, Reason: it works »

Offline claude

  • 3f
  • ******
  • Posts: 1787
    • mathr.co.uk
Re: Actual Implementation of Perturbation Theory for the Mandelbrot Set
« Reply #4 on: February 19, 2019, 05:19:37 PM »
I suspect the precision is lost in the step:

      xZoomPoint = atof(xZoomPointin);
      yZoomPoint = atof(yZoomPointin);

where these variables are long doubles (64bits in Microsoft VC++). But I don't really understand perturbation theory very well.

Yes, that loses precision.  The README says that arbitrary precision is missing, which means you'll only be able to zoom as deep as double allows (pixel spacing around 1e-16).

Offline LionHeart

  • Uploader
  • *
  • Posts: 164
    • ManpWIN Fractal Generator
Re: Actual Implementation of Perturbation Theory for the Mandelbrot Set
« Reply #5 on: February 20, 2019, 07:52:36 AM »
Thank you to quazor, 3DickUlus and Claude for replying.

Claude, I think you hit the nail on the head. I suspected as much. Actually my program ManpWIN uses MPFR/MPIR arbitrary precision libraries and maybe if I use bignum:

replace
      xZoomPoint = atof(xZoomPointin);
      yZoomPoint = atof(yZoomPointin);
with
     mpfr_t xZoomPoint, yZoomPoint ;

     mpfr_set_str(xZoomPoint , xZoomPointin, 100, MPFR_RNDN);
     mpfr_set_str(yZoomPoint , yZoomPointin, 100, MPFR_RNDN);

and use these in the MandelbrotPerturbation program I might make some progress.

I'll need some thought.

Thanks so much for your help  ;)

« Last Edit: November 08, 2020, 12:55:36 AM by 3DickUlus, Reason: Fixed Link!!! »

Offline Shirom

  • Fractal Freshman
  • *
  • Posts: 1
Re: Actual Implementation of Perturbation Theory for the Mandelbrot Set
« Reply #6 on: November 07, 2020, 10:59:41 PM »
Sorry to revive a dead thread, but considering I'm the author of the program, I can provide some support. It's been awhile since I was active and it was under a different username.

The code on Github is designed for you to learn how Perturbation Theory works without having to install all the MPFR/MPIR dependencies first. This means that arbitrary precision doesn't work on it. Every datatype that's a long double needs to be replaced with an MPFR data type for the program to work in arbitrary precision. Also, if you have any other issues with the program, just open a Github issue.

Regarding the library implementation you want, this program will take in a location and a depth and start zooming to it and writing the images from it to disk. It does use a 2d array of Point objects to store the information before writing a frame to disk, so you could always remove the loop where it moves to the next frame, remove the code that writes to disk, and just return the 2d array with all the point data.

Offline LionHeart

  • Uploader
  • *
  • Posts: 164
    • ManpWIN Fractal Generator
Re: Actual Implementation of Perturbation Theory for the Mandelbrot Set
« Reply #7 on: November 08, 2020, 04:47:25 AM »
G'day Shirom,

I have gone a long way since this post. I do use MPFR and get good results... up to a zoom level of 1.0E308 where the double float zoom radius runs out of precision. I tried to replace all the variables with MPFR and it worked... but was ridiculously slow and missed the whole point of perturbation.

I am currently trying out a variable type from the Kalles Fraktaler floatexp. This definitely extends the precision out to about 1.0E1000 without too much of a performance hit. I am having some problems though with artifacts.

If you want to work with me at sorting out some of these problems, I'd be happy for the support. Let me know.

Thanks.


xx
"Time Span"

Started by cricke49 on Fractal Image Gallery

0 Replies
812 Views
Last post August 02, 2018, 07:05:21 AM
by cricke49
xx
Coloring the Mandelbrot set with a perturbation implementation

Started by glorifiedelbow on Fractal Mathematics And New Theories

5 Replies
697 Views
Last post April 02, 2018, 09:49:59 PM
by skychurch
xx
Neural Style Transfer enhanced Mandelbrot zoom

Started by schizo on Fractal movie gallery

6 Replies
732 Views
Last post December 22, 2020, 09:31:14 PM
by schizo
xx
Perturbation theory

Started by gerrit on Fractal Mathematics And New Theories

213 Replies
12450 Views
Last post August 12, 2020, 07:38:03 AM
by gerrit
question
The magic behind Perturbation theory

Started by FractalAlex on Kalles Fraktaler

11 Replies
335 Views
Last post June 11, 2020, 08:39:25 PM
by claude