# way to fool XPP into cobwebbing # first I define a function that every other step evaluates # the map -- in the alternate steps, it just keeps the same # value so that it alternates between horizontal and vertical # jumps # # here is your map f(x)=r*x*(1-x) # # # the parameter scale sets the maximum value of x # for the logistic it is 1 # par scale=1 # g(x,y)=if(mod(t,2)<.5)then(f(x))else(y) # note that 't' is the iteration number 0,1,2,... # if t is even evaluate f otherwise keep the old y y(t+1)=g(x,y) x(t+1)=if(t==0)then(x)else(y) # note that x(t+2)=f(x(t)) so every other point is the map! par r=3.95 init y=0,x=.01 # always start y=0 # # add this plot to the graph to see the actual function # this assumes that you have chosen at least 100 iterates aux map=f(scale*t/100) aux st=scale*t/100 # some convenient settings for the graphics @ xlo=0,ylo=0,xhi=1,yhi=1 @ xp=x,yp=y # tell xpp that it is discrete and iterate 100 times @ meth=discrete,total=100 done