# Mathematica - Showing iterations graphically

1. Jan 20, 2012

### nothingbetter

I'm trying to do this:

Suppose I have some iterative function $x_{n+1}=\sin(x_n)$. I want to demonstrate an iteration on a plot by graphing $y=\sin(x)$ and $y=x$, then drawing lines from the graph of x to the graph of sin x, like in this page:

http://demonstrations.wolfram.com/IteratingLinearFunctions/

I would try to google or check the documentation to do this, but I have no idea on what keywords to use, nor do I have any clue on where to begin.

Thanks!

[I also don't know how to get LaTeX to work in this forum. Sorry!]

2. Jan 20, 2012

### Bill Simpson

y = NestList[Sin, 1, 6]; x = Range[7]; points = Transpose[{x, y}]; ListPlot[points]

might get you started.

From that you need to use the contents of points to generate the horizontal and vertical line segments shown in that demonstration. This
http://reference.wolfram.com/mathematica/ref/Line.html
will give you an idea what result you need to generate from your points.

Last edited: Jan 21, 2012