'Program NELOGMAP.BAS looks for round-off error effects in the logistic map '(c) 1997 by J. C. Sprott (http://sprott.physics.wisc.edu/) CLS DEFSNG A-Z 'Do all calculations in single precision RANDOMIZE TIMER 'Reseed random number generator a = 4 'Logistic growth parameter j& = 0: itot& = 0 WHILE INKEY$ <> CHR$(27) x0 = RND 'Choose random initial condition in (0,1) x = x0 i& = 0 'Initialize the iteration counter DO i& = i& + 1 xold = x 'Save previous value of x x = a * x * (1 - x)'Iterate the map IF x = 0 THEN PRINT "Solution reached 0 after"; i&; "iterations"; j& = j& + 1 itot& = itot& + i& PRINT " - Average ="; CINT(itot& / j&); "- Cases ="; j& EXIT DO ELSEIF x = xo THEN PRINT "Solution repeated after"; i&; "iterations" EXIT DO ELSEIF x = xold THEN PRINT "Solution reached fixed point at"; x; "after"; i&; "iterations" EXIT DO ELSEIF i& > 100000! THEN PRINT "Solution caught in a periodic cycle" EXIT DO END IF LOOP WEND