Mandelbrot_Stuff.html>
• Go back to Main Menu
• Go back to Math
• GOTO Mandelbrot Basic Program
• TOP:

### The Mandelbrot Algorithm

It is my understanding that sometime in the mid 1970's Benoit Mandelbrot noticed that if a complex number 'C seed' (ai+b) were added to a null complex number Z (0+0i); the number Z then squared; and then 'C seed' added again to the Z number followed by another squaring of Z, the sequence repeated forever, unusual behavior of the value of Z occurred. If the selected value of C was small the complex number Z remained small. As the value of the 'C seed' grew larger, at some point the value of Z would grow without bound. With advent of digital computers the intensive math for this routine could be explored. I read that Mandelbrot coined the term "Fractal".

The animated plot above incorporates 24 frames with magnification(s) set in 1, 2, 5 sequence to 50,000,000. The Raster of 'C' values ranges from (-2.25,-1.25) at the lower left corner to (+1.25,+1.25) at the upper right corner. I will post the BASIC program used to develop the above Mandelbrot Plots soon.

An algorithm was developed to perform: Z gets Z2+C for perhaps hundreds of loops or tries. Values of 'C' between (0i+0) and less than about (0.7+0.7i) would orbit around the origin (0i+0) but never grow without bound. Values of Z for 'C' greater than about (0.7+0.7i) would cause Z to eventually grow without bound and 'fly away' from the origin. A 'fly away' radial distance test was implemented to terminate the algorithm if the radial bound was exceeded before a certain number of tries were completed.

The program code I set up for this animation uses a radial distance to terminate of ~7 or radius squared of 49. The maximum Tries was set at 400. If and when the radius squared is exceeded, the quantity of Tries to reach Rlimit=49 is remembered. The program then assigns a color to that 'C seed' position based on Pen=(Tries MOD 7)+1 which yields a spectrum of pen colors from 1 to 7. The number of Tries needed to exceed the Rlimit is a stability test for each of the 'C' points. If the value of Z exceeds the Rlimit quickly, that 'C seed' is unstable. If Z never exceeds the Rlimit at the full number of Tries, that 'C seed' point is painted black and represents a member point of the Mandelbrot set.

Two nested FOR-NEXT Loops are set up to make an orderly raster of C-coordinates to test. The Z gets Z^2+C loop is placed inside the Loops. Upon loop exit by maximum Tries or by Rlimit, the 'C' point is assigned BLACK or a color, respectively.

Notice the (right hand) animation above; Here magnification was set at 1E+6 and the number of Tries was varied from 300 to 1000. As the Tries increased, the background changes (fills in). BLACK area points that remain belong to the Mandelbrot set. However, No 'C' points in this frame belong; all BLACK disappears for Tries=>1000. The marginal stability detail that is seen with lower maximum number of Tries is real; the number of allowed Tries (artificially) affects the apparent marginal stability of 'C' points in those regions, a lower maximum Tries can give a 'C' point the illusion of belonging to the MB set (BLACK).

### The Image below shows just the (White) Mandelbrot Set Points

It is not clear to me if the isolated (white) points around the figure are connected to the central 'Bug' figure by infinitely thin membranes or are actually isolated from the 'Bug' as they appear to be in this picture. The Z gets Z2+C MB algorithm was iterated 27.814 trillion times to develop the white areas in this figure. Total white pixels are 4,635,685. The total white pixel area is 1.50714459 sq units.

### Out Of Curiosity: I Modified The Algorithm To Permit Z To Different Powers Other Than 2

The above Animation shows the general nature of and results from the Algorithm with exponents of Z higher than Two. I don't know if Mandelbrot would have approved; I hope so. And thank goodness for Pascals triangle when writing code for (a+bi)n. Anyways, It appears that the number of 'Heads' on the MB-bug is one less than the exponent of Z. It is interesting that each 'Head' has crown points; the number of crown points is equal to the number of heads on the figure and one less than the exponent. Causes wonderment; as exponent 'N' increases, the 'Heads' get smaller and the figure approaches circular. What does the Mandelbrot area to converge upon as N>infinity? Looks like MB set (BLACK) Area is over 2.7 square units, maybe will asymptote to 2*(2)½ or PI, or plain vanilla irrational? Guess I'm just spoiled; used to happenings like the area under the Gaussian normal distribution being equal to sqrt(PI).

There are actually three dimensions available in Mandelbrot's data; the 2D 'C' data forms a raster and a 3rd dimension representing stability by the number of 'Tries' to 'fly-away' for each 'C' point. The RED cross is the origin (0,0i).

It would be interesting to plot a 3D topology map with X and Y being the complex plane (base of the figure) and Tries being the height. Where ever there is BLACK, the orbit of 'Z' is stable [See NOTE:] in that it never grows without bound. So the 3D figure would look like a flat topped mesa of (arbitrary) amplitude equal to the number of Tries. Tries variable is set in CODE (400 works). The side of the mesa is where all the Mandelbrot beauty would be; the extremely ornamented walls of the figure would drop off to zero height a couple inches away from (0,0i) in the 'C' plane.

### NOTE:, Two Items:

First; In the code I can ENABLE a plot/erase SUB that shows the value of 'Z' as the algorithm is being iterated to establish each 'C-point'. It is fascinating to watch. It is readily apparent that the closer the C(a,bi) is to the origin (0,0i), the closer the iterated value of 'z' buzzes around the origin. As 'C' values in the raster are picked farther from (0,0i), the Z-gadfly can be seen to quickly try to fly off to infinity.

Secondly; FYI, The code is written in (high tech) HTBasic by TransEra. Very proficient operating system that is an out growth of HP (Hewlett Packard) Basic circa 1970-1985, Support was dropped by HP, was picked up by TransEra who have kept it alive with many improvements. Easy to write code for graphics, number crunching, CRT, and Keyboard control. I posted the HTBasic Windows version of the Mandelbrot program, link is at top of page.

I found this reference on Internet tonight

• http://staff.jccc.net/swilson/misc/mandelbrot.htm

See my version of SWilson point(s) plots:

#### See (2nd & 3rd row above) my rendering for S Wilson Coordinates: -0.604492530, 0.61521012i 0.00000056 width (Mag 6.25E+6).

The above animation is a 1x to 1E+11 magnification DIVE into Mandelbrot at SWilsons 'Spiral' location. It includes 6 images for the SWilson magnification of 4,375,000:1 with the Pen Color modulation being the only variable (K) that was changed (Notice K: during Animation). The final magnification in the sequence is 10,000,000,000; this would make the 1x 3.5 by 2.5 inch Mandelbrot picture expanded to 5.5 by 3.9 million miles or about 20x the earth moon distance to show this tiny area at 3.5 by 2.5 inches.

Interesting, none of the coordinate map (raster) points at this (Xc,Yc) point contain 'members' of the Mandelbrot set for magnifications greater than ~3000. At Mag=1000, MB Area of 0.2E-9 sq-units was found. At Mag= 2000, MB Area of 1.19E-10 sq-units was found. Of course, all of the delicate detail is found in the 'marginal stability regime' near 'MB Set Numbers'. Only 'C' raster points that 'never' fly away are defined as belonging to the Mandelbrot Set. Most of the MB Set coordinates are contiguous in the central 'Bug' seen at Mag: 1x. The Bug is, however, replicated at non-contiguous locations which can be seen at very high magnifications. The MB HTBasic BASIC program code enhancements listing is updated (04-May-11).

#### Please do appreciate SWilson's effort finding very interesting locations

The Spiral is beautiful. 24-Apr-11 I added HTBasic Windows version of same SWilson 'C' point. In the lower series of three DOS pictures, the Bug that shows up at over 1,000,000 Magnification is isolated from the main MB figure but is part of the Mandelbrot Data Set. The next three pics above show that increasing the iterations (Tries) sharpens the image, but the remaining BLACK will remain black no matter how many iterations are performed; this is the test for data belonging to the SET.

BTW, I reduced the color pen modulation rate by ~30:1 to get a closer facsimile to SW's location. The MB program for this work so far, is running in DOS is running in windows XP. The Windows version has 16 bit, 64 bit and 256 bit color pallet which will produce smoother color change. I will eventually run ran the code in Windows which version permits automated pict frames stored to a folder to simplify making animations. See Spiral crunched by Windows version of program at right above.

### Mandelbrot Program Code Variables That Can Be Changed To Affect The Rendering

• 1) Location: (Xc,Yc) Center of complex plane Window for interesting point to be viewed; Try SWilson's coordinates (above)
• 2) Magnification: (Mag) Sets width and height dimensions of the Window (1 to 1E6, 1E9, no-limit) At Mag:1 MB window is [-2,25,-1.25] [1.25,+1.25]
• 3) Boundary: (Rlimit) Radial limit test to determine 'fly-away' or stability of the 'C' point. (Using 7 units or Rlimit=49)
• 4) Iterations: (Tries): Allowed iterations to determine stability of a 'C' point, technically infinity, cannot wait that long, (300 to 1000)
• 5) Color Modulation Rate: (K) Number of Tries before color pen is changed to next color. For higher Color Bits, use higher Rate
• 6) Color Bits: Number of different colors used to paint the Mandelbrot Plot [DOS:7, WIN:16,64,256, See var (Penn)]

### Mandelbrot Program Working Pretty Cool

After runnung a MB Picture, Hit [F8] to 2nd Menu. Hit [F4], ON KBD mode, a Key-Trap ON/OFF toggle that invokes the Arrow Keys for cursor move (in any last picture, at any Magnification); re-center the next picture over a new desired location. When arrow key (Xc,Yc) move is complete, toggle [F4] Key-Trap ON/OFF to OFF. The cursor move modifies (Xc,Yc) for the new position. Hit [F8] to go back to HomeMenu. Hit {F1] to bring up (Xc,Yc) and input any desired change in Magnification, followed by [ENTER]. Then hit [F2] Raster to run new Picture.

The code subroutine in 2nd Menu ,DO MOVIE, [F2] works really nice (if I do say so). A do-loop controlled by the number of (Picts) makes and stores that many Images (presently up to 24). When entering 'DO MOVIE' a prompt asks for the base name (EX: MB_nn.gif) for the Image files to store to a 'target' Windows folder I call 'NEW'. A second input prompt asks for desired number of (Picts). The loop count updates 'nn' in 'MB_nn.gif'. To invoke store-to-NEW, hit [F1] SaveFile ON/OFF to ON before hitting [F2] DO MOVIE. The images are only stored in local RAM if [F1] is OFF. If [F3] is ON (before DO MOVIE), all previous Picts are shown in review in 0.7 second intervals before the next image Raster begins. After DO MOVIE is complete (could be hours), pictures in RAM can be incrementally re-viewed by repeatedly hitting [F3] in HomeMenu.

The code can be modified to make any of the controlling variables change from picture to picture. So, when an interesting MB point at high magnification is found by sneaking up on it using the cursor and magnification increases, then a sequence of unattended images can be automatically stored in the 'NEW' folder. After each new Pict,. The stored images are full screen size so I use MS Paint to trim the images to a fixed pixel size, something like 320 by 242 pixels. Then use MS GIF Animator to make an animation show; very cool utility.

Be careful folks, the real estate to explore in this 9 square units of area rivals the Universe. It's Fractally Impossible (pun intended). You could spend a lifetime... Don't do this or chess at work.

• ### [TOP]

• Go back to Math