[comp.sources.atari.st] v03i062: bifurc -- Draw bifurcation diagrams

koreth@panarthea.ebay.sun.com (Steven Grimm) (06/02/90)

Submitted-by: WJOHNSTON@COLGATEU.BITNET (Michael Johnston)
Posting-number: Volume 3, Issue 62
Archive-name: bifurc

100   'This program, written in ST Basic, uses a "difference equation"
110   '(line 330) to model the effects of driving a dynamic system at
120   'increasingly high rates. The result is a bifurcation diagram
130   'which represents the growth rates of biological populations
140   '(on the Y axis) at increasingly high rates of fertility (X axis). At
150   'low to moderate fertility rates, rates of increase
160   'reach an equilibrium. But at higher rates, a boom-and-bust
170   'cycle is revealed in the form of "period doubling"; and further
180   'to the right, the results are chaotic. For a more detailed
190   'discussion, see James Gleick, CHAOS: MAKING A NEW SCIENCE
200   '(Viking 1987), pp. 59-80. Be forewarned: this program takes
210   ' a LOOOONNNNNGGGGGGG time to run ( ~ 40 minutes), but the
220   'results are interesting. Note also that by playing with the
230   'values of R and X (line 310), and the integer values in
240   'the second statements of lines 390 and 510, you can
250   '"zoom in" on various segments of this diagram.
260   'Have fun--
270   '          Michael Johnston  (WJOHNSTON@COLGATEU.BITNET)
280   COLOR 1,1,1
290   FULLW 2:CLEARW 2
300   DIM REG (167)
310   R=1.01:X=.02:ST=0:P=0:T=80:VS=0
320   ST=ST+1
330   XN=R*X*(1-X)
340   IF ABS(XN-X) < .000001 THEN 380
350   IF ST>T THEN 420
360   X=XN
370   GOTO 320
380   R=R+0.01:X=.02
390   V=166-(XN*166):H=((R-1)/4)*600
400   PCIRCLE H,V,0
410   ST=0:GOTO 320
420   P=P+1:VS=VS+1:IF VS>1750 THEN T=40
430   REG(P)=XN
440   IF P<3 THEN GOTO 360
450   FOR I=1 TO P-1
460   IF ABS(REG(P)-REG(I))<.000001 THEN GOTO 500
470   NEXT
480   IF P=166 THEN GOTO 500
490   GOTO 360
500   FOR I=1 TO P-1
510   V=166-(REG(I)*166):H=((R-1)/4)*600
520   PCIRCLE H,V,0
530   NEXT
540   ST=0:P=0:R=R+0.01:X=.02:GOTO 320