- a = 3.5

Enter the function to iterate, the seed, x0, and the number of iterates, n.

Input := 

a = 3.5;
g[x_] = a x ( 1 - x );
h[x_] = g[g[x]];
x0 = 0.7;
n = 100;

Create a list of Points on the Orbit Diagrams for both f(x) and f(f(x))

Input := 

pts1 = Table[0, {i, 1, 2n + 1}];
pts2 = Table[0, {i, 1, 2n + 1}];
x1 = x0;
pts1[[1]] = {x0, g[x0]};
pts2[[1]] = {x1, h[x1]};
Do[x0 = g[x0];
   x1 = h[x1];
   pts1[[i]] = {x0, x0};
   pts2[[i]] = {x1, x1};
   pts1[[i + 1]] = {x0, g[x0]};
   pts2[[i + 1]] = {x1, h[x1]},
   {i, 2, 2 n, 2}];

Plot the Points

Input := 

iterateplot1 = ListPlot[pts1,
 PlotJoined -> True,
 DisplayFunction -> Identity];
Input := 

iterateplot2 = ListPlot[pts2,
 PlotJoined -> True,
 DisplayFunction -> Identity];

Plot the Map along with the Replacement Line

Input := 

mapplot1 = Plot[{x, g[x]}, {x, 0, 1},
 PlotStyle -> {AbsoluteThickness[1], 
               AbsoluteThickness[2]},
 AspectRatio -> Automatic,
 PlotRange -> {0, 1},
 DisplayFunction -> Identity];
Input := 

mapplot2 = Plot[{x, h[x]}, {x, 0, 1},
 PlotStyle -> {AbsoluteThickness[1], 
               AbsoluteThickness[2]},
 AspectRatio -> Automatic,
 PlotRange -> {0, 1},
 DisplayFunction -> Identity];

Plot the Orbit Diagram

Input := 

Show[iterateplot1, mapplot1,
 AspectRatio -> Automatic,
 PlotRange -> {{0, 1}, {0, 1}},
 DisplayFunction -> $DisplayFunction]
Output =

-Graphics-

Plot the Orbit Diagram for the 2nd Iterate Map.

Input := 

Show[iterateplot2, mapplot2,
 AspectRatio -> Automatic,
 PlotRange -> {{0, 1}, {0, 1}},
 DisplayFunction -> $DisplayFunction]
Output =

-Graphics-