> # maporbit.ms # Iteration of 1-Dimensional Maps > maporbit := proc(F, x0, skipiter, displayiter) > local x, k, c, orbit; > x := x0; # starting value > # skip some iterations before collecting points > for k from 1 to skipiter do x := F(x); od: > orbit := array(1..displayiter,1..6); > for c from 1 to 3 do > for k from 1 to displayiter do > orbit[k,2*c-1] := skipiter+(c-1)*displayiter+k-1; > orbit[k,2*c] := x; > x := F(x); > od: > od: > op(orbit); > end: # Can also convert to a list for more convenient processing if desired. > orbitlist := proc(orbit) > local i, j; > seq( seq( [orbit[i,2*j-1],orbit[i,2*j]], > i=1..linalg[rowdim](orbit)), j=1..3); > end: # Test the procedure on the logistic map > Q := (x) -> a*x*(1-x): > a := 2.9: maporbit(Q, 0.1, 1000, 10); > a := 3.2: maporbit(Q, 0.1, 1000, 10); # Test sensitivity to initial conditions > a := 3.2: maporbit(Q, 0.1, 10000, 10); > a := 3.2: maporbit(Q, 0.100001, 10000, 10); # Test sensitivity to initial conditions > a := 3.9: maporbit(Q, 0.1, 10000, 10); > a := 3.9: maporbit(Q, 0.100001, 10000, 10); >