Find root using fixed point iteration. Can this be right?

581 Views Asked by At

Working on old exams in basic numerical modeling, I have gotten confused by the solution proposal.

Problem: Use the fixed point iteration method to find the root for $f(x)=2x-e^{-x}$ in the interval $(0,1.6)$ with an error less than $0.02$.

My thoughts:

$g(x)=\frac{e^{-x}}{2}\ $

$x_{i+1}=g(x_i), i=1,2...\ $

Convergence criterion (from book):

$|x_{i+1}-g(x_{i+1})| \le \epsilon=0.02$

With $x_1=1$, $x_5=0.3595185038$ would be the root from my calculations. However, an extra computation is done in the solution proposal. Why? What is it I'm missing? Is the extra computation done due to the truncation of decimals?

Solution proposal: enter image description here

Book: enter image description here

 i     x_i         g(x_i)       |x_i+1-g(x_i+1)|
 1  1.0000000000  0.1839397206   0.2321
 2  0.1839397206  0.4159929770   0.0862
 3  0.4159929770  0.3298424517   0.0297
 4  0.3298424517  0.3595185038   0.0105
 5  0.3595185038  0.3490061677  
1

There are 1 best solutions below

2
On BEST ANSWER

I think this is again some artifact of a manual evaluation of a computation result without "automatic" stopping condition. If the stopping condition were actually implemented, one would get your result. Also, it seems rather disadvantageous to write the step as $i\to i+1$. It makes no sense to compare in step $i$ the sequence elements $x_{i+1}$ and $x_{i+2}$. The algorithm is

repeat
   i=i+1
   x[i+1] = g(x[i])
until abs(x[i+1]-g(x[i+1]))<eps
return x[i+1]

but should be better implemented as

repeat
   i=i+1
   x[i+1] = g(x[i])
until abs(x[i+1]-x[i]) < eps
return x[i]

with only half the calls to $g$ and comparing $x_i$ and $x_{i+1}$ in step $i$.