Mandelbrot Set: Region #23

Mad Teddy's web-pages


Mandelbrot set: Region #23

Click on the picture to see a 640 x 480 pixel version.

If you've seen this page in which my Commodore 64 version of this part of the Mandelbrot set appears, you'll know that in the "Computer Recreations" column of the February 1989 issue of Scientific American, A.K.Dewdney presented a graphic sent in by a reader, Andrew laMance, entiltled "Love Canal". This featured a black, winding shape somewhat resembling a river or estuary, surrounded by beautiful but dark bands of colour with a somewhat threatening look about them.

In his article, Dr. Dewdney stated that he presumed that the name referred to a certain notorious polluted area in New York State near Niagara Falls. He suggested that the black part was reminiscent of "a drainage ditch filled with toxic chemicals where strange vegetation struggles to survive".

Rather gloomy, don't you think?

The graphic above was my first attempt to produce a PC-based graphic of the area. The basic shape is correct, so clearly I'd found the right area; but apart from that, the picture bears little resemblance to Mr. laMance's original. Well, thereby lay a challenge!

You can download and save a copy of the BASIC source-code for the 640 x 480 version by right-clicking here.

In the following graphic, the white rectangle gives an indication of the whereabouts of the Love Canal within the M-set. Note, however, that this rectangle is actually too big by a factor of 1,000. Our area of interest is at its centre. We're doing a deep zoom here! (At the bottom of this page, you can see some animations which show the zoom actually occurring, thus enabling a much better appreciation of the Love Canal's relationship to the overall M-set.)

The black rectangle to the east of the white one shows where the Love Canal isn't. A misprint crept into Dr. Dewdney's article, so that the coordinates of the central point were given as (.235125, .82722), rather than (-.235125, .82722). As mentioned in the page whose link appears above, I found by experiment that changing the sign of the x-coordinate successfully pin-pointed the required area.

(There's another page on the web which mentions this same fact - click here, scroll about 7/8 of the way down to the bottom, and read on from there.)

As in several others of my initial attempts at particular areas, the first alteration was to space the ribbons out so that there would be much less "crowding" of colours near the M-set itself. The following two graphics resulted. You'll notice that there's very little difference between them; the reason for including both here is that I later did further adjustments using each of them as a starting point, as detailed below.

Love Canal - Variation "A"

Click on the picture to see a 640 x 480 pixel version.

You can download and save a copy of the BASIC source-code for the 640 x 480 version by right-clicking here.

Love Canal - Variation "B"

Click on the picture to see a 640 x 480 pixel version.

You can download and save a copy of the BASIC source-code for the 640 x 480 version by right-clicking here.

To produce the next graphic, I used Neopaint to vary the colours in Variation "B" above, just as I've done in previous pages:


Click on the picture to see a 640 x 480 pixel version.

The main thing to notice about all three graphics presented so far is that the "Canal" part corresponds to what I normally refer to as the "white buffer zone", with the black M-set appearing as small islands within it. (I used an iteration limit of 10,000 to produce them.) The usual four-colour "aura" appears as usual around these black bits and within the white area. The effect is that of a clean waterway. No hint of pollution here; everything is sweetness and light!

However, in Mr. laMance's original, that entire area was black, with a narrow white "aura" which then gives way to bands of lurid colour - creating a very different impression. The final graphic in this page is my attempt to produce something similar (given that I only have a 16-colour palette), using the original as a guide. This time, I started with variation "A". To get the wide black area, I reduced the iteration limit to 250. The remaining colours are simply the standard DOS colours. I haven't altered them in any way; I've simply applied them in a different order.

I think I've achieved a nicely poisonous effect - well, I certainly wouldn't want to swim in it!


Click on the picture to see a 640 x 480 pixel version.

You can download and save a copy of the BASIC source-code for the 640 x 480 version by right-clicking here.

UPDATE, Wednesday, 8th November, 2006

Well, here's a surprise.

While researching my "It's still not easy being green" page, I've inadvertently run across something about the real Love Canal in Niagara Falls.

Above is my model of a molecule of 2,3,7,8 tetrachlorodibenzo-p-dioxin (TCDD), which I've referred to in that page. While "Google-hunting" for some information about this very toxic substance, I found this web-page which mentions the fact that TCDD was found at Love Canal.

It really is a small world, isn't it...?

Now, as promised above: an animated GIF showing a zoom from the whole M-set down to the Love Canal, giving a perspective of just where it is and how it fits into the big picture. I've done this in black and white, basically for two reasons: firstly, in the interests of clarity, as a stark two-tone version emphasizes the structures involved; and secondly, to keep the size of the file down to a sensible level (151Kb). (Actually, there's a third reason: the truth is that I don't know how to do an effective job of this in glorious technicolour, and I'm not disposed at the moment to take the trouble to find out! )

You may have seen sophisticated videos showing zooms of the Mandelbrot set or other fractals. I have an ABC video from 1988 entitled "Chaos: the Theory which Imposes Order Within Disorder" which includes some delicious footage of this type. Perhaps you've seen rock videos which use M-set zooms as a background, giving a kind of up-to-date hi-tech psychedelic effect. (As mentioned in a 31-10-2010 update to my ...Region #8 page, the video of the 12" version of a 1988 hit, "Stand Up for Your Love Rights" by Yazz, is an excellent example.) These are always spectacular; the surrealistic effect of the sinuous black areas surrounded by fizzing colour is definitely something to behold.

Well, that's not what we have here - sorry!

Such impressive movies, if they are to happen in "real time", require powerful supercomputers to generate the individual frames quickly enough. That's not what you get with an old 1997 Windows 95 PC! So what we do have here is basically a black-and-white slide show.

This involves 101 graphic frames, with 100 individual zooms, using the same ratio of dimensions each time. The vertical height (y-direction) of the first frame (showing the whole set) is 2.5; and that of the final frame (showing the Love Canal itself) is 0.0001008. This corresponds to an overall zoom factor of 24801.5873, very close to the value used by Andrew laMance (24,800) in his original. Thus each of the 100 individual zooms involves a factor of 24801.58730.01 = 1.106483125, or approximately 10.6% each time.

The "flea" from which the Love Canal "sticks out" first becomes visible in Frame 16. Just keep watching that spot indicated at the beginning to see it grow and assume its true form. Also, do keep in mind that the Mandelbrot set is connected - which means that the "flea" is part of the whole set, and joined to the more obvious large parts of it, even though this is not necessarily immediately obvious at this level of magnification. Similarly, all apparently isolated dots in the later frames are, in reality, also parts of a connected whole.

To me, Frame 100 looks more like a rampaging gnarly elephant than anything else...

You can download and save a copy of the BASIC source-code by right-clicking here.

I've also decided to include within this page the source code for the program I used to generate the 101 frames:

REM ***             MAD TEDDY'S M-SET ZOOM PROGRAM             ***

REM Zooming in on the "Love Canal", starting from the entire M-set

SCREEN 12: REM graphics, 640x480

iterationlimit = 250

numberofframes = 100

REM coordinates for first frame
ylow1 = -1.25
yhigh1 = 1.25
xlow1 = -2.15
xhigh1 = xlow1+(yhigh1 - ylow1) * 4 / 3

REM coordinates for final frame
ylow2 = .8271696
yhigh2 = .8272704
xlow2 = -.2351922
xhigh2 = xlow2+(yhigh2 - ylow2) * 4 / 3

REM dimensions of first frame
xlowdelta = xlow2 - xlow1
ylowdelta = ylow2 - ylow1

REM dimensions of first frame
xhighdelta = xhigh2 - xhigh1
yhighdelta = yhigh2 - yhigh1

k = LOG((yhigh1 - ylow1) / (yhigh2 - ylow2))

FOR frame = 0 TO numberofframes

    REM print frame number at bottom - three digits
    LOCATE 16,16: PRINT "Frame  ";
    IF frame < 100 THEN PRINT "0";
    IF frame < 10 THEN PRINT "0";
    PRINT RIGHT$(STR$(frame), LEN(STR$(frame))-1)

    lambda = frame / numberofframes
    z = 1 - EXP(-k * lambda)

    ylow = ylow1 + z * ylowdelta
    yhigh = yhigh1 + z * yhighdelta
    xlow = xlow1 + z * xlowdelta
    xhigh = xhigh1 + z * xhighdelta

    FOR i = 0 TO 239
        FOR j = 0 to 319
            x = xlow + j * (xhigh - xlow) / 319
            y = yhigh - i * (yhigh - ylow) / 239
            xc = x: yc = y
            iterations = 0
            rsquared = 0
            DO UNTIL rsquared >= 4 OR iterations > iterationlimit
                u = x * x - y * y + xc
                v = 2 * x * y + yc
                rsquared = u * u + v * v
                x = u: y = v
                iterations = iterations + 1
            LOOP
            IF rsquared >= 4 THEN
                PSET (j,i), 15: REM plots a white dot

                REM don't bother plotting a black dot if point is in M-set
                REM - just leave it as it is, black, and save a bit of time

            END IF
        NEXT j
    NEXT i

    BEEP

    a$ = ""
    DO: a$ = inkey$: UNTIL a$ = " "

    CLS

NEXT frame


UPDATE, 5th November 2010:

I've just discovered an error in the transcript of this program. The line which has said:

xhigh2 = xlow1+(yhigh2 - ylow2) * 4 / 3

since I launched this website in early July 2006, has now been corrected to:

xhigh2 = xlow2+(yhigh2 - ylow2) * 4 / 3

(Note that this error was only in the transcript above - not in the downloadable program itself.)

Apologies for any confusion this may have caused. (Please - if you spot any other errors in any of my programs and/or transcripts of same within these pages, do be good enough to contact me and let me know, so that I can fix them.)


The program simply generates the 101 frames one at a time, with a beep at the end of each one. Pressing the space bar clears the screen and starts the next one. I used Neopaint's "Neograb" feature to save the frames before pressing the space bar each time, and then later used DISPLAY to crop the results to 320×254 pixels (the top-left part of the screen). Finally, I used Microsoft's GIF Animator to assemble them (along with a title frame and the "Watch this spot" frame, both produced with the aid of Neopaint) into a 103-frame animated GIF.

The iteration limit used throughout is 250. This is the same figure I used to generate the "toxic" version of the picture (above); it gives good results without taking a ridiculously long time.

Note that this program can easily be modified to generate frames for a zoom to any part of the M-set! All you have to do is put in appropriate values for ylow2, yhigh2, and xlow2, corresponding to the location of your "target area".

In fact, you can zoom towards that area from anywhere in the M-set; you don't have to start from the whole set! To do this, simply change the values for ylow1, yhigh1, and xlow1. One area may be totally enclosed in the other (as in the current example), or they may overlap - or they may even be in totally different parts of the plane, with no points in common at all! If you wanted to, you could have a "journey" from any one of my examples presented in these pages to any other, with or without a zoom (inward or outward). Whether you get an interesting result will depend on the details of the "journey", i.e. what lies between the two locations. (Obviously some such "expeditions" will give better results than others.)

Finally, you can have more or less frames - all you need to do is change the value of numberofframes - and, of course, you can also change the value of iterationlimit to suit yourself (the bigger it is, the longer the process will take).

To give a clear idea of how the zoom actually operates, here is an animated GIF (102Kb) showing just every fifth frame of the above animation, together with a graphic indication of where each frame is with respect to the entire M-set:

Notice that the white box is only visible for the first half of the animation (as far as frame 50); after that it becomes too small, and disappears into the "vanishing point" at (-0.2351151, 0.8272533). The zoom factor for this animation is 24801.58730.05 = 1.658523453, or approximately 66% each time. The box dimensions therefore shrink by a factor equal to the reciprocal of this figure, i.e. 0.602942678, with each zoom. Hence the zoom factor for frame 50 - halfway through both this animation and the previous one - is the square root of 24801.5873, i.e. 157.4851971. The "flea" mentioned above first makes its appearance, in this version, in Frame 15.

The BASIC program used to generate the frames for this animation was produced by modifying the program for the other animation, above. You can download and save a copy by right-clicking here. (I used Neopaint to help in producing the opening frame, and also to make a few colour modifications - in particular, the yellow for the boxes, which is thus a bit darker than the standard DOS yellow.)

Feel free to modify either or both of these programs, and use the results to take your own personalized tour around the Mandelbrot set. As a starting-point, you may like to zoom up on some of my other examples within these pages. Then you might get inspired to embark on some adventures of your own.

Go ahead - experiment, and have some fun!

UPDATE, Saturday, 30th October 2010

A few weeks ago - and before I found on YouTube the video of Yazz's "Stand Up for Your Love Rights" featuring fractal graphics, as mentioned above - I discovered some other very good YouTube videos which do indeed show the surrounds of various parts of the Mandelbrot Set in fizzing colour. I've already made reference to this in an update at the bottom of my Fractals #1... page; and I've decided that it's highly appropriate to repeat the details in this page also, in case you missed it on the way here.

Here is a link to the first of six videos which together make up a program hosted by the late Arthur C. Clarke which features some mathematicians - including Dr. Mandelbrot himself - discussing aspects of fractals in general and the M-set in particular, and which includes a delightful soundtrack by David Gilmour of Pink Floyd. The other five videos are easily located within YouTube's own indexing system, along with several other videos in similar vein. Well worth a look - check 'em out!

Return to Fractals #1: the Cantor and Mandelbrot sets

My home page     Preliminaries (Copyright, Safety)