import graph_pi;
texpreamble("\usepackage{amsmath}");
real k=3.2;
real f(real x){return k*x*(1-x);}
real g(real x){return f(f(x));}
graphicrules(unit=8cm,
xmin=0, xmax=1, ymin=0, ymax=1);
draw(graph(f),legend="$f:x\longmapsto 3.2x(1-x)$");
draw(graph(g),blue,legend="$g:x\longmapsto{}(f\circ f)(x)$");
cartesianaxis();
draw(graph(new real(real x){return x;}), grey);
draw(recursivegraph(g,.12,n=12),
recursiveoption(Label("u",align=2S),
labelplace=onX,
labelinner=false,
px=dashed+lightgrey,
xmarker=nomarker,
circuitarrow=Arrow(position=Relative(.5),size=2mm)),
.8red, legend="$u_{n+1}=g(u_{n})\;\text{et}\;u_{0}=0.12$");
draw(recursivegraph(g,.6,n=12),
recursiveoption(Label("v",align=2W),
labelplace=onY,
labelinner=false,
py=dashed+lightgrey,
xmarker=nomarker,
circuitarrow=Arrow(position=Relative(.5),size=2mm)),
.8green, legend="$v_{n+1}=g(v_{n})\;\text{et}\;v_{0}=0.6$");
attach(legend(), point(S), 5S);