Field lines in the Mandelbrot set

Field lines in the Mandelbrot set

Comput. & GraphicsVol. 16, No. 4, pp. 443--447, 1992 Printed in G~eat Britain. 0097-8493/92 $5.00 + .00 © 1992 Petsamon Press Ltd. Chaos and Graphic...

1MB Sizes 0 Downloads 105 Views

Comput. & GraphicsVol. 16, No. 4, pp. 443--447, 1992 Printed in G~eat Britain.

0097-8493/92 $5.00 + .00 © 1992 Petsamon Press Ltd.

Chaos and Graphics FIELD LINES IN THE M A N D E L B R O T SET KENELM W. PHILIP Institute of Arctic Biology,University of Alaska, Fairbanks, AK 99775 Abstract--A technique for displayingcolor imagesof fieldlines surrounding the Mandelbrot Set using angleslicing decomposition and a "contrast color lookup table," is described. A modification of this method, which compensates for the spatial-frequencydoubling inherent in angle-slicingdecomposition, can produce black and white images that even more accurately portray the field lines. contours. Figure 1 shows two views of the M-set with different escape radii--2 in Fig. l(a), and 100 in Fig. l(b). Figure 2 shows an enlarged view of these contours for the spike of the M-set, and it is clear that the contours in Fig. 2(b) are appropriately shaped for equipotential lines. It would be interesting to have a simple way to display the "field lines" of this hypothetical electric field, for the Mandelbrot set or for other images involving the level set method. A first approximation to these field lines may be obtained through binary decomposition[3]. Figure 3(a) shows an image of the M-set, using an escape radius of 10, where each pixel outside the set has been set to either black or white, depending on whether the value of the imaginary part of Z was positive or negative when Z passed beyond the escape radius. The transitions from black to white that run orthogonal to the iteration-number contours are short sections of field lines, hut the broken-up nature of the plot, and the wide separation between adjacent transitions, tend to overshadow the rendition of the electric

Plotting the Mandelbrot set using the level set method[ I ] involves iterating the following equation: Z ,--~Z 2 + C,

(1)

where Z and C are complex numbers, and testing whether Z is farther from the origin than a previously assigned escape radius. It is well known that if the escape radius is large compared to the size of the set, the iteration-number contours map out equipotential lines in the electric field that would be present if the M-set carried an electric charge[2]. The usual escape radius of 2, on the other hand, gives a very different set of

(a)

(a)

(b)

(~

Fig. I. Mandelbrot set showing iteration number contours. (a) escape radius=2; (b) escape radius= 100.

Fig. 2. Spike of Mandelbrot set showing iteration-number contours. (a) escape radius=2; (b) escape radius= 100.

443

444

KENELM W. PHILIP

(a) Fig. 4. Mandelbrot set using angle-slicing decomposition.

(b) Fig. 3. Mandelbrot set with binary decomposition. (a) escape radius= 10; (b) escape radius= 100. field. Figure 3b shows another M-set image where the escape radius was set to 100, and binary decomposition produces somewhat narrower blocks that give a slightly better rendition of the field lines. Recently, I received a block of True BASIC source code that used a different kind of decomposition: angle-

slicing decomposition[4]. Rather than testing for the sign of the imaginary part of Z, this method computes the arc tangent ofzi/zr, and then assigns black or white to the pixel according to the value of the angle as the escape radius is passed. Along any given iterationnumber band, the number of black/white alternations is a function of the fineness or coarseness of the angleslicing, which may be set by the programmer--and a fine slicing can produce blocks that are (locally) a series of parallel lines orthogonal to the iteration-number bands. Note, however, that the spatial frequency of the resulting pattern doubles each time you move one iteration band closer to the set. Angle-slicing decomposition is admirably suited to displaying the field lines, as Fig. 4 indicates, and can be set to yield blocks of any desired width at any given iteration-number band, for any choice of the escape radius. To this point we are on well-trodden ground, although I have not seen M-set images that utilize angleslicing decomposition specifically to suggest field lines. Two experiments that I carried out resulted in an im-

Fig. 5. Mandelbrot set: Field lines.

Fig. 6. "Sea Horse" in Mandelbrot set: Field lines.

Fig. 7. Tail of "Sea Horse": Field lines.

Fig. 8. Midget at Re = - 1.99638 on spike: Field lines.

446

KENELM W. PHILIP

Fig. 9. Mandeibrot Set.

Fig. 10. 'Sea Horse' in Mandclbrot set.

d' Fig. 11. Tail of 'Sea Horse'.

proved ability to map M-set field lines, as described below. I incorporated the angie-slicing routine in my own True BASIC color Mandelbrot program, and linked it to the "contrast color lookup table (CLUT)" coloring scheme I was using. In an RGB color system, one can make a simple contrast coloring scheme by taking the six simple colors (red, yellow, green cyan, blue, magenta) and cycling each one in turn through a preset

Fig. 12. Midget at Re=-1.99638 on spike.

number of intensity levels. If M-set iteration numbers are then keyed to this so-called contrast CLUT, you get a coloring system that tends to accentuate structures that lie some distance from the M-set boundary. Experimentation with this program yielded some rather striking color images in which the field lines can easily be traced. The distinct changes of intensity within each hue allow the field lines to be followed even within a block of a single hue, and the large change of intensity between hues highlights the field line at the boundary. When the spatial-frequency doubling at higher iteration numbers makes the hue blocks too narrow for the intensity changes to show, the hue blocks themselves map the field tines. If the angle-slicing is set to a sufficiently small value, the electric field around the M-set is well mapped until one gets so close to the set that aliasing obscures the tines. Figures 9-12 show the field lines around the M-set and various features within the set according to this method. Even angle-slicing decomposition shows a doubting of the number of"field lines" each time you move one iteration number closer to the set. It would be interesting to have a means of showing the field lines which, over at least a limited range ofiteration numbers, would display a constant number of lines over a given angle independent of distance from the set. For the simpler case of black and white imaging, I was able to arrive at such a scheme by multiplying the color number within a given iteration band by an appropriate power of two to counteract the spatial-frequency doubling. The effect of this correction is shown in Figs. 5-8, which cover the same regions as Figs. 9-12. The decision not to follow the frequency-doubling correction down into the valleys in these figures was deliberate--the weakening of the field in the valleys would have led to the entire valley being colored black or white, with no indieation of its interior field structure. The Appendix discusses the code that produced these images. REFERENCE~

1. H.-O. Peitgen and D. Saupe, The Science of Fractal Images, Spfinger-Veflag New York, 187-188 (1988). 2. H.-O. Peitgen and P. H. Richter, The Beauty of Fractals, Springer-Verlag, New York, p. 163 (1986).

Field lines in the Mandelbrot set 3. H.-O. Peitgen and P. H. Richter, The Beauty of Fractals, Springer-Verlag, New York, 40-44, 64-76 (1986). 4. J. Corbit, personal communication, after J. D. Jones, Decomposition: They went thataway--Another way of viewing the object. AMYGDALA, 13, 2-3 (October, 1988). APPENDIX

Code for angle-slicing decomposition Below is the iteration subroutine used to produce the color images. The plotting area used is 500 pixels wide by 400 pixels high, on a 640 X 480-pixel screen (Macintosh 1I). Another subroutine set up 240 colors to a sequence of 10 intensity steps each of red, yellow, green, cyan, blue, and magenta-making 60 different colors that repeat 4 times to occupy 240 successive color numbers. The language being used (True BASIC 2.01 ) allowed assignation of over 240 RGB colors to color numbers, which could be accessed by the ' ' SET COLOR c o l o r n u m b e r ' ' statement. Variables are:

447

p h i = a t n (zi/zr ) I compute angle for Z IF z r > 0 THEN IF z i > 0 THEN theta=phi ELSE theta=360+phi Iset quadrant ELSE theta=lS0+phi END IF colr=int((theta*240)/360) Imap 240 color # s on to 360 degrees SET COLOR c o l r / d i v + l Icomplete angle slicing with parm 'div' END IF NEXT n PLOT x + 1 0 , y + 1 0 SET COLOR ' 'black ' ' zr=0 zi=0 NEXT y END IF NEXT

x

END SUB

realcent:

real value of the center of the plotting rectangle. imagcent: imaginary value of the center of the plotting rectangle mag: magnificationinrelationtoastandard view of the region from - 2 . 0 to + 0 . 5 along the real axis, defined as having mag=l. dwell: m a x i m u m iteration number ersqr: square of the escape radius SUB Iterate zr=0 zi=0 FOR x = l TO 500

r=-l.5/mag+realcent+x*(.OO625/mag) FOR y = l TO 400 i = --l.25/mag+imagcent+y* (.00625/mag) FOR n = l TO dwell zsqr=zr*zr--zi*zi zi=2*zr*zi+l zr=zsqr+r sizesqr=zr*zr+zi*zi IF s i z e s q r > e r s q r THEN nn=n n=dwell

To produce the black and white field line images (Figs. 4-7), the line SET COLOR c o l r / d i v + l

wasreplaced withtwolines: IF nn
where fl dwell is set by trial and error so that the desired portion of the image is occupied by field lines without spatialfrequency doubling. The colors were set by having successive blocks of color numbers assigned alternately to black and white, and d i v was set to 1. The block size was set by trial and error for a reasonable width for the field lines. The black and white binary decomposition images were made by replacing the entire angle-slicing section with a simple test for the sign of z i , coloring black or white according to sign. The black and white angle-slicing image (Fig. 3) was made by setting the 240 colors to alternate black and white in blocks of 60 (30 white and 30 black), using a d i v of 1.