Python: Mandelbrot explorer 0.9 now save and resume update Jan 23 /2022
06-09-2021, 08:31 PM (This post was last modified: 01-23-2022 11:01 PM by Guenter Schink.)
Post: #1
 Guenter Schink Senior Member Posts: 476 Joined: Dec 2013
Python: Mandelbrot explorer 0.9 now save and resume update Jan 23 /2022
edit Jan22/2022
Major changes:

1. Solid Guess
3. Time out
4. Auto Save / Resume
5. using "TEXTOUT_P() from HOME without to much hassle
/edit

Next exploration on Python!

Please keep in mind, that I'm a real beginner with Python and that I have no great experiences with other program languages other than a little bit of basic and pascal 30 years ago. And some RPN and RPL of course :-). The objective is to explore some specifics of Python on the Prime. The Mandelbrot set is a welcome test bed.

After my first attempts with Python on the Prime I have now completed something I'd like to share with you. It's a Mandelbrot explorer. Here https://en.wikipedia.org/wiki/Mandelbrot_set is a summary of what this set is.

This program let's you dig really deep into the fascination of the Mandelbrot set at a very amazing speed for a calculator.

My program starts with the well known picture of the Mandelbrot set. Upon completion of the first drawing it will immediately show an introductory help screen, telling you about the keys to be pressed.

When going back to the Mandelbrot display you might be disappointed a little bit by the less than perfect resolution. But this of course has a reason. The calculations for each pixel may take an awful lot of time. Therefore I decided to at first plot in "coarse" mode (a square of 4x4 pixels instead of one pixel at a time). This enables you to go rather quick (for a calculator) through the different zooms back and forth. Once you decide to have a better resolution, press [Plot] and there you go and you'll immediately recognize how much more time the fine draw needs over the coarse draw.

You zoom in with just a touch on the screen. Your hit will determine the center of the new picture enlarged by a zoom factor of initially 4. The backspace (Del) key brings you back the previous pictures up to the first one. A little square in the top left corner will tell you the current process was finished. (Beep is missing )

The second row X^Y, SIN,COS,TAN,LN,LOG lets you switch between different color schemes, these are: black and white; 8, 27, 64, 125 and 216 colors of RGB

These different color schemes are really useful. While the higher color numbers show overall nicer pictures, those with only 27 or less provide you with a 3D appearance when zoomed in at specific places and iterations set to higher values. Selecting larger iterations will get you there.

[Plot] as mentioned before, the fine draw

[Num] shows the values of the current screen: Iiterations, magnification, zoom factor, co-ordinates, colors, time needed for the creation of the display.

The set starts at the co-ordinates (-2, 1) for the real part and (1.2,-1.2) for the imaginary part. Initial number of iterations(depth) is 20. The depth will increase by 10 each time you push [+]; [-] consequently will decrease the depth until a minimum of 10. [x] and [÷] will increase/decrease the iterations by 50.

[x²]/[EEX] increase/decrease the zoom factor. Best done when you had switched to the information screen [Num]. There you'll immediately see, what you've selected.

[Help] shows the introductory screen again, with the information on the keys.

[Home] takes you back to the initial screen.

[Esc] finally lets you exit. There you have the choice to restart or switch to the Home (or Cas) screen.

If you are interested in examining my program, for Windows users I'd strongly recommend "notepad++". With the "notepad++" feature of collapsing you have a great view on the simple structure which is otherwise hidden by the lines of code. And "notepad++" is a great help in tracking the various levels of indentation, that's so important with Python.

Tribute to Geoff whose Mandelbrot Program was fundamental to get the components that I had already created before in a reasonable order. I even applied a lot of the names he used, because they are so nicely descriptive.

Unpack the.zip, copy the directory"MandelExpl.hpappdir" to (most probably) "C:\Users\<some user>\Documents\HP Connectivity Kit\Content\Programs" and from there let the Ck send it to your Prime.

Please let me know of any quirks you might encounter. I'd really love to get some comments and perhaps suggestions.

Enjoy, Günter

Discussion, hints on Python specifics are very welcome

Attached File(s)