SET MODE "graphics"

PRINT "N ITERATIONS OF THE LOGISTIC EQUATION: Xn+1=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 1): ":X0

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

SET WINDOW -.05*N,1.05*N,-.05,1.2

PLOT 0,0;N,0;N,1;0,1;0,0

PLOT TEXT, AT -.04*N,0:"X=0"

PLOT TEXT, AT -.04*N,.97:"X=1"

PLOT TEXT, AT 0,-.05:"ITER=0"

PLOT TEXT, AT .98*N,-.05:"ITER=N"

PRINT

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

LET Xold=X0

FOR i = 0 to N step 1

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

PLOT i,Xold;

LET Xold=Xnew

NEXT i

END