0

Consider the function $g(x)=e^{-x^2}$. With a starting approximation of $p_0=0$, use the iteration scheme $p_n=e^{-p_{n-1}^2}$ to approximate the fixed point on $[0,1]$ to within $5 \times 10^{-7}$.

So, our teacher did not go over this section, but assigned it for homework and I have no idea where to even start with this. Could someone help me with this please?

Brian
  • 711
  • 1
  • 10
  • 20
  • You need to calculate (see Michael's answer below) untill $n=84$ untill you get the answer to desired accuracy so don't do it by hand:) – Winther Sep 03 '14 at 23:47
  • Why go until n=84? – Brian Sep 04 '14 at 01:36
  • You will have to keep iterating until $|p_n - p_{n-1}| < 5\cdot 10^{-7}$. It just turns out numerically that you will have to go until $n \sim 80$ before this accuracy is achieved. – Winther Sep 04 '14 at 01:45

1 Answers1

3

It seems self-explanatory. If it doesn't strike you that way, let's try this:

You wrote $p_n=e^{-p_{n-1}^2}$.

The index $n$ can be $0,1,2,3,4,5,\ldots$.

You said $p_0=0$.

So we have \begin{align} p_1 & = e^{-p_0^2} & (\text{In this case, $n=1$ and so $n-1=0$.}) \\[8pt] p_2 & = e^{-p_1^2} & (\text{In this case, $n=2$ and so $n-1=1$.}) \\[8pt] p_3 & = e^{-p_2^2} & (\text{In this case, $n=3$ and so $n-1=2$.}) \\[8pt] & \text{and so on.} \end{align} You know $p_0$. In the first line above, you find $p_1$. It's a number. You use it in the second line, and thus you find $p_2$. That's another number. Then you use that in the third line to find $p_3$. And so on.


You might also note that $p_{2n}<p_{2n+2}<p_{2n-1}<p_{2n+1}$. In words, the terms jump back and forth over the solution. As a result, your error after $n$ iterates is less than $|p_n-p_{n+1}|$. This allows you to determine when to stop or (actually, I presume) when your program should stop.

Mark McClure
  • 30,510