SET MODE "graphics"

 

PRINT "N ITERATIONS OF MAY MAP: Xn+1= Xn +a*Xn*(1-Xn)"

PRINT

INPUT PROMPT "ENTER PARAMETER VALUE a (between 0 and 4): ":a

INPUT PROMPT "ENTER THE SEED VALUE X0 (between 0 and 2): ":X0

INPUT PROMPT "ENTER THE NUMBER OF ITERATIONS N (integer):":N

CLEAR

SET WINDOW -.1*N,1.1*N,-5,5

SET COLOR "RED"

PLOT 0,-4;N,-4;N,4;0,4;0,-4

PLOT 0,0;N,0

PLOT 0,1;N,1

SET TEXT JUSTIFY "center","half"

PLOT TEXT, AT -1,0: "0"

PLOT TEXT, AT -1,1: "1"

SET TEXT JUSTIFY "center","top"

PLOT TEXT, AT 0,0: "0"

PLOT TEXT, AT N,0: STR$(N)

PRINT

PRINT "","MAY MAP","a=";a,"X0=";X0,"N=";N

LET Xold=X0

SET COLOR "BLUE"

FOR i = 0 to N step 1

LET Xnew=Xold + a*Xold*(1-Xold)

IF Xold>100 THEN EXIT FOR

IF Xold<-100 THEN EXIT FOR

PLOT i,Xold;

LET Xold=Xnew

NEXT i

 

END