10 CLS
20 PRINT "                   BIFURC/BAS by Ed J. Gracely
30 PRINT :PRINT
40 PRINT "Creates a bifurcation tree illustrating the transition from a simple
50 PRINT "regular pattern to a chaotic pattern.
60 PRINT:PRINT
70 PRINT "The user inputs the starting value of the parameter and the increment
80 PRINT
90 PRINT "First split happens around 3.0; things get rapidly more
100 PRINT "interesting around 3.4 and become a jumble around 3.6
110 PRINT
120 PRINT "There are still interesting things to see with a fine incrementation
130 PRINT "even down in the 3.7, 3.8, 3.9 region, however.
140 PRINT:PRINT
150 INPUT "What starting value ";START
160 INPUT "What increment ";INC
170 R = START - INC
180 CLS
190 PRINT CHR$(15)   ' Cursor off
200 FOR LR= 1 TO 23
210 X = .3      ' Starting value for X
220 R = R + INC ' Value of R for this row
230 IF R > 4 THEN PRINT @(LR,20), "Values over 4 don't work":END
240 PRINT USING "#.###";R;
250 FOR L = 1 TO 100   ' Toss first 100
260 X = R*X*(1-X)      ' The iteration at the heart of the program
270 IF X> 1000 OR X < -1000 THEN GOSUB 420:GOTO 390
280 NEXT L
290 NTIME = 50
300 IF R > 3.4 THEN NTIME = 200   ' Need more samples out here
310 FOR L = 1 TO NTIME
320 X = R*X*(1-X)
330 IF X> 1000 OR X < -1000 THEN GOSUB 420:GOTO 390
340 XPRI = FIX(79*X + 1)
350 IF XPRI < 6 OR XPRI > 79 THEN 370
360 PRINT @(LR,XPRI),"*";
370 NEXT L
380 PRINT
390 NEXT LR
400 INPUT CDUM$
410 END
420 PRINT @(LR,20), "Value <-1000 or > 1000. Going to infinity? "
430 RETURN
