Iteration of functions -- Maple code

Maple code for constructing the graphs of the sequence { x_n } where
   x_{n+1} = f(x_n)
First we defin the function iterplot:
 > iterplot := proc(x0,n,f)
     local i, d, x;
      x := x0;
      d := [[0,x]]; 
      for i from 1 to n do
	 	x := f(x);
        d := [op(d), [i, x]];
      od;
      plot(d);
  end;

The we define the function f
 > f := x ->k*x*(1-x);
Then we use iterplot:
 > k := 2; # define constant in f
   
 > iterplot( 0.1, 10, f );


Back