Post Reply 
Python: Mandelbrot explorer 0.9 now save and resume update Jan 23 /2022
07-11-2021, 03:45 PM
Post: #5
RE: Python: Mandelbrot on fire, the explorer
Mandelbrot explorer update 2021-07-11 Updated in post#1

After some nice days of vacation, I returned to my Python testbed, the Mandelbrot Explorer. The basic description in post #1 still applies. But I've done some changes for a hopefully much nicer appearance. And I'll ask the moderators to move this thread to the Prime Software Library.

When you start the program, you'll recognize that the screen is quickly filled with blocs which broadly resemble the Mandelbrot set. But then the drawing is going on - on the left hand side a small progress bar is visible that tells you that the program is active still, and will finish shortly Smile

A small explanation, how it's done and where you might adjust things with ease.

The drawing is done in different stages.

CoarseDraw: this procedure draws blocs of arbitrary size. Here I choose 10 and 4 pixels high and wide to quickly show something that looks already similar to the Mandelbrot set, these values can be changed at will.

The last bloc is 2 pixels high and wide, this value must not be changed, because the procedure further on is dependent on this value.

Now we have the screen filled with blocs of 2x2 pixels each of the color of the top, left pixel. That is on each even line number (lines y start with 0) in each even column the pixel (columns x start with 0) has got the correct color. The other three pixels in the 2x2 square may be right or not.

Next step I call dithering (not quite correct, but ...) : Take the lines where y is odd, start with the column where x is odd and set each second pixel to its correct color. After that we have half of all the pixels set to the correct color and many of the others also, rather randomly.

By this procedure we avoide to do the time consuming calculation more than once for each pixel. The first two paintings of blocs (10 and 4) are negligible time-wise.

FineDraw: Last step is to get the right color for the remaining pixels. Start at the first line (y=0) set x=1 (x=0 already has the correct color) calculate the correct color for each second pixel. That is the pixels with x=odd get calculated and colored. Then in the next line (y=1) we do the same with the pixels where x=even. We continue, so that in lines where y=even all pixels where x=odd, and in lines where y=odd all pixels where x=even get calculated and colored correctly.

Why all this fuss? The Mandelbrot set does an awful lot of calculations. I start now with the maximum Iterations set to a depth of 100. While the calculator is working you have a fair view on to what is developing. By omitting the last FineDraw , the required time is only almost half of the time required for the full procedure. Yet it already shows a reasonable (in my view) appearance where you might like to go deeper and deeper, before you decide to press [Plot] for the perfect picture. The limit for magnification is ~2^13

What can be adjusted easily:

Line 16: set CompleteAllPasses=False to True, specifically for the Virtual Prime for convenience.
Line 60: for size in (10, 4, 2) don't change "2" but you may play with the other figures, even add some Smile e.g.(20, 15, 10, 8, 6, 2)
Line 190: change the initial boundaries for the set
line 191: change the initial values for the depth(Iterations), mag(which color scheme), initial ZoomFactor

It is really unbelievable how fast this Python implementation is on the Prime.

Kudos to the "Stone Soup Group" for FRACTINT and for H.-O-Peitgen and P.H.Richter for the book "The Beauty of Fractals".

Feed back is very welcome

Günter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Python: Mandelbrot on fire, the explorer - Guenter Schink - 07-11-2021 03:45 PM



User(s) browsing this thread: 1 Guest(s)