# code for cobwebbing discrete logistic function # define the function as a procedure in Maple f := proc(x, k) (1+k)*x*(1 - (k/(k+1))*x) end proc; #look at 100 iterations number_iterations := 100: # keep track of the output out := Array(1..number_iterations): # start somewhere close to equilibrium (1) out[1] := .9: # look at the dynamics for some value of k k := .5: get the output and print it for i from 2 to number_iterations by 1 do out[i] := f(out[i-1], k): end do: print(convert(out, list)); # plot the updating function along with # the line y=x and the first few outcomes # for cobwebbing with(plots): with(plottools): Arrow1 := arrow([out[1], out[1]], [out[1], out[2]], .005, .05, .2, arrow): Arrow2 := arrow([out[1], out[2]], [out[2], out[2]], .005, .05, .2, arrow): Arrow3 := arrow([out[2], out[2]], [out[2], out[3]], .004, .05, .3, arrow): Arrow4 := arrow([out[2], out[3]], [out[3], out[3]], .005, .05, .2, arrow): Arrow5 := arrow([out[3], out[3]], [out[3], out[4]], .004, .05, .5, arrow): Arrow6 := arrow([out[3], out[4]], [out[4], out[4]], .005, .05, .8, arrow): Graph := plot([f(x, k),x], x=0..1.5): display(Arrow1, Arrow2, Arrow3, Arrow4, Arrow5, Arrow6, Graph);