'Iterating x = x<**2 + c 'This equation may be thought of as a real-axis only version of Mandelbrot's 'z = z**2 + c. The program StdLog2.bas does exactly the same for the above 'equation as stdLog1.bas does for x = rx(1 - x). Typical values for c: 'for c = .5 and beyond, x skates off to infinity 'for c = .15, x climbs to a steady value 'for c = 0, x stays at zero 'for c = -.5, x climbs to a steady negative value 'for c = -1, x oscillates with period 2 'for c = -1.3, x oscillates with period 4 'for c = -1.4, x oscillates with period 8 'for c = -1.5, bounded chaotic oscillation 'for c = -1.7, a good demonstration of bounded chaos 'for c = -1.75, periodic oasis within chaos - period 3 'for c < -2, x rapidly goes wild into infinite chaos 'StdLog2.BAS screen 9,3 color 7,0 th = 3 'text horizontal bias s = 1.5 'horizontal scaling factor n = 40 'integral extent of the axes h = 300 'horizontal zero bias v = 240 'vertical zero bias nn = 550 'extent of time-series horizontal axis hh = 25 'time-series horizontal bias vv = 60 'time-series vertical bias ss = 50 'inter-iteration delay Lab: 'INPUT THE VALUE OF c locate 16, th : print"Iterate the formula y = x * x + c " locate 23, th : print"Press RETURN to exit program. " locate 17, th input"Enter c = ",r$ 'input the growth factor for this run if c$ = "" then end 'exit if nothing entered c = val(r$) 'growth factor cls 'clear the screen locate 14, th : print"FEIGENBAUM'S EXPERIMENT" locate 16, th : print"Iterating the formula y = x * x + c" locate 17, th + 2 : print"for c = "; c$ locate 23, th : print"Press any key to stop program." locate 19, th : print"yMAX =" locate 20, th : print"yMIN =" 'DRAW AXES FOR THE TIME-SERIES DIAGRAM ts = 1 'set time-series flag c = 3 'set colour to cyan for axes t = nn : x = 0 : gosub p 'set pen to end of time axis t = 0 : gosub l 'draw line to time-series origin x = 2 : gosub p x = -2 : gosub l 'draw time-series y-axis locate 2, 3 : print "y" locate 5, 74 : print "time" 'DRAW THE GRAPH AXES FOR THE FEIGENBAUM DIAGRAM ts = 0 'clear time-series flag x = 2 : y = 0 : gosub p 'set pen to end of x-axis x = -2 : gosub l 'draw line to -1 x = 0 : y = 2 : gosub p 'set pen to end of y-axis y = -2 : gosub l 'continue line to end of y-axis locate 11, 56 : print "y" locate 18, 73 : print "x"; 'DRAW THE DIAGONAL BOUNCE-LINE c = 11 x = -2 : y = -2 : gosub p 'set pen to origin x = +2 : y = +2 : gosub l 'draw diagonal line to point 1,1 'DRAW THE CURVE OF THE NON-LINEAR DIFFERENCE FUNCTION flag = 0 for x = -2 to 2 step .01 gosub f if y < 2 and y > -2 then if flag = 0 then flag = 1 : gosub p else gosub l end if end if next 'ITERATE NON-LINEAR DIFFERENCE FUNCTION UNTIL A KEY IS PRESSED oldx = 0 t = 1 'initialise the time u = 61 'start of trace-clearing sweep ymax = 0 'holds maximum excursion of y ymin = 1 'holds minimum excursion of y x = .3 'set initial value of input y = 0 'for position of first plot gosub p 'set plotting pen to start value e = 0 'reset the out-of-range flag while inkey$ = "" 'while user has not pressed a key xx = x : yy = y 'store starting co-ordinates c = 15 : gosub w 'draw the two lines in bright colour 'for ft = 0 to ss : next 'delay to aid visibility of trace sound 200 * (y + 3), 1 gosub TimeSeries 'put plot on time-series graph x = xx : y = yy 'retrieve the starting co-ordinates c = 1 : gosub w 're-draw the lines in dim colour wend : goto LAB 'return for next c-value if key hit 'TIMES-SERIES GRAPH PLOTTING ROUTINE TimeSeries: ts = 1 'set time-series flag c = 10 newx = x 'save new value of function output if t > nn then t = 1 'if end of sweep has been reached x = oldx : gosub p 'set to previous plot position t = t + 8 'increment the time axis x = newx : gosub l 'draw line to current plot oldx = x 'save current x for next pass if u > nn then u = 1 uu = u + hh : uuu = uu + 10 for i = uu to uuu line(i, vv - n - n) - (i, vv - 1), 0 'draw a trace-wiper line (i, vv + n + n) - (i, vv + 1), 0 'in blue background next u = u + 8 ts = 0 'clear the time-series flag return w: 'DRAW VERT/HORZ LINE-PAIR (L-SHAPE) if e = 0 then 'provided y has not gone out of range gosub p 'set the start of the line gosub f 'iterate the non-linear function if y < -2 or y > 2 then 'if y is now out of range e = 1 'set the out-of-range flag locate 21, th : print"Gone out of range: y ="y" " else gosub l 'draw the up-line x = y : gosub l 'draw the across-line end if end if return p: 'set starting point for current line gosub q : pset(a, b), c : return l: 'draw line to point x, y gosub q : line -(a, b), c : return q:'CONVERT REAL X/Y CO-ORDS TO SCALED INTEGRAL NUMBERS OF PIXELS if ts = 0 then a = s * (h + n * x) b = v - n * y else a = hh + t b = vv - n * x end if return f:'ITERATE DIFFERENCE FUNCTION. CHECK THAT RESULT IS IN RANGE y = x * x + c if y > ymax then ymax = y : locate 19, th + 8 : gosub num if y < ymin then ymin = y : locate 20, th + 8 : gosub num return num: y$ = str$(y) : PRINT y$ + space$(13 - len(y$)) return 'November 1997 Robert John Morton