# Plotting iterated functions

As explained to me here, one can plot iterations of a point "b" in A under the functions f:A -> A. Is it also possible to plot the entire function iterated, meaning given a function "f", is it possible to plot f composed with f; or f composed m times with itself ?

-
As mentioned in the comments of your earlier question, you should show what you have tried so far, preferably as a a fully compilable MWE – Peter Grill Apr 1 '12 at 14:59

I'm not sure if I understand correctly the question but a possibility is below. I give you two different ways but for f composed m times with itself I think it's not possible. Perhaps a TeX's wizard can find a solution but I'm very sceptic. Perhaps you can provide further informations so that we can give you a better solution.

\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{ arrows, calc}

\begin{document}
\begin{tikzpicture}[scale=10,
declare function={f(\t)=(exp(\t)-1)/(exp(1)-1);},
declare function={f2(\t)=f(f(\t)));},
declare function={f3(\t)=f(f(f(\t))));}]
\draw [help lines,step=.2] (0,0) grid (1,1);
\draw[->] (-0.2,0) -- (1.2,0) node[right] {$x$};
\draw[->] (0,-0.2) -- (0,1.2) node[above] {$y$};
\draw [blue,
thick]
plot [domain=0:1, samples=100, smooth] (\x,{f(\x)});
\draw [red,
thick]
plot [domain=0:1, samples=100, smooth] (\x,{f2(\x)});
\draw [green,
thick]
plot [domain=0:1, samples=100, smooth] (\x,{f3(\x)});
\end{tikzpicture}

\begin{tikzpicture}[scale=10,
declare function={f(\t)=(exp(\t)-1)/(exp(1)-1);},
declare function={g(\t,\n)= equal(2,\n) ? f(f(\t)) : f(f(f(\t)));}
]
\draw [help lines,step=.2] (0,0) grid (1,1);
\draw[->] (-0.2,0) -- (1.2,0) node[right] {$x$};
\draw[->] (0,-0.2) -- (0,1.2) node[above] {$y$};
\draw [blue,
thick]
plot [domain=0:1, samples=100, smooth] (\x,{f(\x)});
\draw [red,
thick]
plot [domain=0:1, samples=100, smooth] (\x,{g(\x,2)});
\draw [green,
thick]
plot [domain=0:1, samples=100, smooth] (\x,{g(\x,3)});
\end{tikzpicture}

\end{document}


Function involutive fof =Id

\begin{tikzpicture}[scale=2,
declare function={f(\t)=1/(\t-1)+1;},
declare function={f2(\t)=f(f(\t)));}]
\draw [help lines] (0,0) grid (5,5);
\draw[->] (-0.2,0) -- (5.2,0) node[right] {$x$};
\draw[->] (0,-0.2) -- (0,5.2) node[above] {$y$};
\draw [blue,
thick]
plot [domain=1.3:5, samples=100, smooth] (\x,{f(\x)});
\draw [red,
thick]
plot [domain=1.3:5, samples=100, smooth] (\x,{f2(\x)});
\end{tikzpicture}


-