Welcome to Fractal Forums

Fractal Software => Help & Support => Topic started by: David041697 on March 16, 2017, 07:46:36 PM




Title: (C++) How to deep zoom in mandelbrot set?
Post by: David041697 on March 16, 2017, 07:46:36 PM
Hi,

I'm an undergraduate physics student and I know the basics of programming. I recently became very interested in fractals, after studying the math behind them, I decided to start with the Mandelbrot Set. I made a pretty simple program in C++ and I'm using doubles. I zoomed in to E-13 and after that I started to loose precision to the point I wasn't able to continue without some inconveniences.

So, my question is, how can I go deeper? I tried long doubles but even for a relatively small number of iterations (1000), it takes too much time to make a single image.

I'm aware that there are some programs that help with making fractals but I'm more interested in making the program. Any help is very appreciated.

Thanks,
Juan David 


Title: Re: (C++) How to deep zoom in mandelbrot set?
Post by: lycium on March 16, 2017, 08:45:45 PM
Hi, welcome to the forums.

You need to use an arbitrary precision arithmetic library, and these will be very slow compared to native doubles. You can get a lot of speed back on modern CPUs by using multi-threading (can be as easy as adding "#pragma omp parallel for" at the top of your toplevel for-loop, i.e using OpenMP), since each pixel is independent.

There are some recent potential advances using perturbation methods to try to reduce the amount of precision needed for most of the deep zoom computation, but:

1. Currently there is no way to do this robustly, i.e. without "glitches" that need to be manually checked for and corrected using special cases etc
2. It's a bit fidgety to implement, and you still need an arbitrary precision arithmetic "base computation"
3. Makes multithreading a lot more complex

Perhaps you can lend your physics background to addressing issue #1, as far as I know it's still an unsolved problem (the author of UltraFractal claimed to have a robust solution in 2014, but so far still unreleased). Here's the page about it (from Norfolk island!): http://www.superfractalthing.co.nf/

Bonus question, and I hope you won't mind my asking: what interests you in deep zooms? Personally I don't see any true novelty in deeper zooms, just like how we've all seen the digits 1-9 in pi.


Title: Re: (C++) How to deep zoom in mandelbrot set?
Post by: David041697 on March 16, 2017, 11:45:16 PM
Hello,

Thank you for responding, my interest in doing a deep zoom is something I wanted to do from the start. When I became interested in fractals I found the idea of being able to zoom in to any point I wanted and see what would happen as something attractive. I don't want to do a deep zoom in the scale of 10^2000 , for example, but I would like to see some interesting stuff at a smaller scale (10^100 maybe).


Title: Re: (C++) How to deep zoom in mandelbrot set?
Post by: Kalles Fraktaler on March 18, 2017, 10:03:14 PM
Hello David041697

Me an lycium have somewhat different opinions of the robustness of perturbation, so I'll give you my opinion for balance :)
My view is that it is indeed possible to do this robustly, the problems we are having is that we want to push it as far as it can go.

The thing we call perturbation consist of 2 things:
  • Calculate one pixel with high precision and use it as a reference for all other pixels. This method will fail though, however thanks to Pauldelbrot we have a trustable method of detecting the pixels where the reference fails to compute the pixel with hardware precision. These pixels can be rendered with a reference closer to these pixels, so a typical perturbation render use several references.
    This method gives a speedup at about 10 times on depths of 10^100
  • Use a truncated Taylor series to approximate a starting value for a specific iteration, which make you able to skip all previous iterations.
    This method gives a speedup of typically Another 10 times on depths of 10^100, and together the speed up is typically 100 times.
    This, which we call Series Approximation, is where we have issues since we do not have any solid theoretically way of finding when too many iterations are skipped - for all pixels in the view. The more terms you include in the Taylor series, the more iterations you are able to skip. So if you stay below say 50 terms, it is not likely that you ever encounter any issues. Because some views can be correctly rendered 1000 or 100,000 times faster than full precision for each pixel with many terms - can you imagine a month turned into seconds!  :o
    K.I.Martin originally used only 3 terms
The link lycium provided is the best introduction, however it doesn't include Pauldelbrot's glitch detection method any only use 3 Series Approximation terms


Title: Re: (C++) How to deep zoom in mandelbrot set?
Post by: quaz0r on March 19, 2017, 04:33:55 AM
Quote from: kalles
Me an lycium have somewhat different opinions

 O0