Automatic generation of general quadratic map basins

Automatic generation of general quadratic map basins

Comput. Pergamon & Graphics,Vol. 19, No. 2, pp. 309-313, 1995 Copyright Q 1995 Elsevier ScienceLtd Printed in Great Britain 0097~8493/9S $9.50 + .o...

19MB Sizes 1 Downloads 74 Views

Comput.

Pergamon

& Graphics,Vol. 19, No. 2, pp. 309-313, 1995 Copyright Q 1995 Elsevier ScienceLtd Printed in Great Britain 0097~8493/9S

$9.50 + .oo

0097~8493( 94)00157-X

Chaos and Graphics

AUTOMATIC

GENERATION OF GENERAL MAP BASINS JULIEN

QUADRATIC

C. SPROTT

Department of Physics, University of Wisconsin, Madison, WI 53706, USA, e-mail: [email protected] and CLIFFORD A. PICKOVER IBM Watson Research Center, Yorktown Heights, New York 10598, USA, e-mail: [email protected]

Abstract-In this informal article, we describe simple approaches whereby a computer can automatically select parameters and generate a large collection of diverse, aesthetically appealing fractal patterns based on general quadratic map basins. Computational recipes are included to encourage reader involvement. In essence, we describe methods for teaching a computer to be both an artist and a critic of its own art. 1. INTRODUCTION

An infinite number of monkeys with an infinite number of typewriters (word processors,nowadays)will eventually reproduceevery work of Shakespeare. The problem is that someonehasto sort through all the gibberishto find the occasionalgem. On the other hand, the criteria for visual art are much lessconstrainedthan for literary composition.A monkeywith a paintbrushhasa reasonablechanceof producinga pattern that someonewould considerartistic. We have been experimenting with replacing the monkeyby a computerandhaving it generatea collection of visually interestingpatterns.Unlike the monkey, thecomputercanbe trainedto selectthoseimages

Onelessoaof chaostheory is that simple,nonlinear equationscan have complicatedsolutions.The solutions are mostinterestingif they involve at leasttwo variables,x and y, which can be usedto represent horizontal and vertical positions,and if the variables are advancedstep-by-stepin an iterative process.The simplestnoniinearitiesare quadratic (x2 or xy). The mostgeneraltwo dimensionalquadraticiteratedmap is: J&W== a + bx + cx2 + sky + ey +fy2 Ynew:= g + hx + ix2 f jxy + ky + ly2

wherea throughI are constantschosenat randombut heldthe samethroughoutthe calculation.Think of this asa mathematicalfeedbackloop wherenew valuesfor x and y are usedagainin the next round of iteration by setting x = x,,,, and y = ynew.The constantscan be consideredas settingsof a combinationlock, each revealing a different pattern for you to admire.They opendoorwaysto an infinite reservoirof magnificent shapesand forms. There are many ways to display the solutionto our generalmaps.One way is to plot successive valuesof x and y as dots on the screen.Many of the solutions will move toward a point and remain there. Others will settleinto a periodicorbit, or will moveoff toward infinity. The interesting casesare the chaotic ones which remainconfinedto a limited regionbut whose 2. GENERAL TWO-DIMENSIONAL QUADRATIC ITERATED MAPS orbits producea strangeattractor with intricate fractal Traditionally when physicists or mathematicians structure.You can choosethe startingvaluesof x and sawcomplicatedresults,they often lookedfor compli- y arbitrarily within the basin of attraction, but you cated causes.In contrast,many of the shapeswhich shoulddiscardthe first few iteratessincethey probably follow describethe fantastically complicatedbehavior lie off the attractor. of the simplestof formulas.The resultsshouldbe of Another way you candisplaythe solutionis to solve interestto artistsand nonmathematicians, andanyone the equationswith many different startingvaluesand with imaginationand a little computerprogramming countthe numberof iterationsrequiredfor the solution Skill. to wander outsidesomeregion in the xy plane. You that are likely

to appeal to humans. The procedure

is to take somesimpleequationswith adjustablecoefficients chosenat random, solve the equationswith the computer,and display those which meet criteria that we have found to be strongindicatorsof artistic quality. One approachis to useequationswith chaoticsolutions. Such solutionsare unpredictableover the long term yet exhibit interestingstructuresas they move abouton a strangeattractor, a fractal object with noninteger dimension.Our books show many examples of computerart producedby theseand related methods[l-31. Here we proposeanother simplemethod for producingfractal art.

309

310

I. C. SPROTT and C. A. PKKOVER

can use the final number of iterations to determine the color for that point in the plane of initial xy values. Plots produced in this way are called escape-time fractals because the color contours indicate the time required for the orbit to escape from the region. Some initial values may have orbits that never escape, and so you need to have a “bailout condition” beyond which your program stops iterating and moves on to test the next initial condition. Some of the most artistic examples of escape-time fractals explored in the past have been Julia sets of the map z.,, = z* + c, where z and c are complex numbers [4,5]. In terms of x and y this map is Gz,w = x

YIWV

2

3. COMPUTER

=2xy+b

SUB advancexy (x, y, n%) SHARED a() xnew = a(1) t x * (a(2) t a(3) y = a(7) t x * (a(8) t a(9) * x = xnew n% = n% t 1 END SUB

'Loop y)

until

a key

is

pressed

n% = 0

* x + a(4) t a(l9)

SUB display () FOR i% = 0 TO 639 FOR j% = El TO 479 x = -5 t i% / 64 ;9=-50j% / 48

CRITIC

'Array of coefficients 'Reseed random numbers 'Assume VGA graphics

'Advance

x

ART

Visually interesting escape-time fractals are those for which the orbits escape slowly. We have found that escape times between about a hundred and a thousand produce the most fascinating maps. We start by choosing the twelve coefficients randomly over the range - 1.2 to 1.2 in increments of 0.1, and then we iterate the equations for our generalized quadratic map with initial conditions of x = y = 0. If we find a group of coefficients that result in the initial point escaping beyond a circle of radius 1000 centered at the origin within 100 to 1000 iterations, then we save the param

--‘+a

DIM a(U) RANOOMIZE TIMER SCREEN 12 n% = 0 WHILE INKEY$ = “I’ IF n% = 0 THEN CALL set arams(x, CALL advancexy(x, y, n% P CALL testsoln(x, y, n%) IF n% = 1000 THEN CALL display: WENO END

WiI;E

and the test escape region is normally taken as a circle of radius of 2 centered on the origin. These traditional Julia sets are a special case of the more general maps we propose in this article.

'Plot

(x, * y)

y)

at

step

t y * (a(5)

* y) + y * (a(l1)

escape-tiire

n% + a(6) a(12)

+

* y) * y)

contours

n% < 128 AND x * x CALL advancexy(x, y,

WEND PSET (i%, NEXT j% NEXT i% END SUB SUB setparams (x, SHARED a() x = rJ: y = 0 FOR i% = 1 TO 12: END SUB

j%),

n% MOD 16

y) a(i%)

'Set = (INT(25

* RND)

a() - 12)

SUB testsoln (x, y, n%) 'Test the IF n% = 1000 THEN n% = El 'Solution IFx*x+y * y > lt3900tXI THEN 'Solution IF n% > 100 THEN n% = 1000 ELSE n% = 0 END IF END SUB Fig. 1. ESCAPE.BAS:

A BASIC

and

initialize

/ 10:

(x,y)

NEXT i%

solution is bounded escaped

program for automatically producing fractals similar to those shown.

an unlimited

number

of escape-time

311

Generation of general quadratic map basins

Fig. 2. Escape-time fractal for parameters EHPLWTDJRCAP.

eter set andcomputean escape-timefractal for a particular region of the x-y plane.The choice of 1.2 for the coefficient rangeis aboutoptimalfor speedingthe search,andit allows the coefficientsto be compactly representedas letters of the alphabet(A = - 1.2, B = - 1.1, through Y = 1.2) for easy reference and replication. The listing ESCAPE.BAS (Fig, 1) showsa BASIC program for producing an endlesssuccessionof escape-timefractals by this method.It shouldrun without modificationunderQBASIC, QuickBASIC, VisualBASIC for MS-DOS, or PowerBASIC on the IBM PC. It assumes VGA graphics(640 X 480 pixels X 16colors). When run on a 486DX33 underPowerBASIC 3.0, the programtakeson averageabout ten secondsto find eachinterestingcaseandabout a minute

to plot it. In the processof searchingfor what we call “beautiful parameters,’ ’ it discardsabout300 setsfor every one it savesfor plotting. This still leavesabout 200 trillion cases,nearly all of which are different. If you view themat the rate of oneper second,it would take over six million years to seethem all, and thus it is very unlikely that any of the patternsyou produce will ever have been seenbefore. We often run the programovernight andcapturethe screensto graphics files,which canbe rapidly examinedthenext morning. 4. SAMPLE

ARTWOW

Although the programsand methodswe have describedwork well with personalcomputersand producegood-qualitypatternswithin VGA screenlimits, we becamecuriousasto how our approachcould be

Fig. 3. Mount Fractalia, a three-dimensional representation of Fig. 1.

312

J. C. SPRO~

and C. A. PICKOVER

extended to higher resolutions (Figs. 2-8). NaturalIy, high-resolution, high-iteration computations would take longer to perform. To-overcome these problems and push our method to the limit, we made use of *IBM’s Power Visualization System, a graphics supercomputer which can compute our general quadratic iterated map in parallel using up to 32 Intel i86OXP processors. This means that the computer can simultaneously work on different portions of the artwork and therefore greatly reduce the time needed to explore a large number of images to find interesting structures. With our software and special hardware we can compute and view images at VGA resolution in under a second. The images in this article were computed at a resolution of 1600 X 2400 pixels using 1000 iterations for each pixel. Computation and display required less than a minute for each high-resolution image. The final step in aesthetic presentation involves the mapping of escape times to colors. Although beautiful images result from simple color mappings, such as the one used in the BASIC code, we used custom software which permits the algorithmic or mouse selection of colors from a palate of 2” colors in a convenient fashion. It is also possible for us to render the maps in three dimensions, representing escape time as height. The Power Visualization System enables us to fly-by the 3D maps in real-time, permitting us to make video-tape animations characterizing the intricate behavior of these functions.

Fig.

5.

Escape-time

fractal

for

parameters

MWRQ-

FVMKUVFK.

Fig. 4. The Fractal Curtain, an escape-time parameters WBMLNRQMNRAA.

fractd

for

Fig.

6. Escape-time

fractal

for parameters FLAR.

KUONOVSV-

Generation of general quadratic map basins

Fig. 7. Escape-time

fractal for XPQMMTWRJ.

parameters

EMXI-

In the future, high-endmethodssuchas thesewill be accessible to everyoneasPC power increases,cost decreases, andInternet collaborationssuchasoursbecomecommonplace [ 21. In our own collaboration,input parametersweregeneratedon a personalcomputer in Wisconsin,electronically sentover the Internet to New York, at which point they werereadby the Power Visualization Systemand rendered. To artistsandcomputergraphicsprogrammers,the automatedgenerationof our generalizedquadraticmap representationshas great appeal becausethe speedallowsthe humananalystthe freedomto experiment with many parameters.Studentsand teachers will enjoy suchan approachasthey explore anddemonstratethe complexity andchaosassociated with simple formulas. Mathematiciansmay find the approach usefulbecausethe sheernumberof different structures they can generatehasthe potential for making complex behaviorsapparentwhich might have beenoverlooked using traditional approaches. 5. FURTHER

SUGGESTIONS

The methodwe have describedis simpleand effective, but we do not claim it is the final word on auto-

Fig.

8. Escape-time

313

fractal for JTKDCRWY.

parameters

JLLG-

matedcomputerart. You canexplore othercriteria for selectingthe patternsandother ways to display them. We chose a generalizedtwo dimensionalquadratic map to emphasizethe complexity and variety that arisesfrom simpleequations.You can easily extend the techniqueto other mathematicalfunctions and to higher dimensions.The sameideascan be used for automaticgenerationandevaluationof computermusic. We would like to hear of any interestingresults obtainedby readersusingour approach. REFERENCES

1. J. C. Sprott, Strange Attractors: Creating Patterns in Chaos, M&T Books, New York ( 1993). 2. C. A. Pi&over, Mazes for the Mind: Computers and the Unexpected, St. Martin’s Press, New York ( 1992). 3. C. A. Pickover, Chaos in Wonderland: Visual Adventures in a Fractal World, St. Martin’s Press, New York (1994).

H. 0. Peitgen and P. H. Richter, The Beauty ofFractals: Images 0jComplex Dynamical Systems, Springer-Verlag. New York (1986). 5. B. Mandelbrot, The Fractal Geometry of Nature, Freeman, New York ( 1993).

4.