I am looking at an example which finds the root of:
$$ f(x) = \cos(3x) \tag 1$$
using the fixed point iteration method. It uses
$$ g(x) = \frac{2x+\cos(3x)}{2} \tag 2$$
However, it was my understanding that to get $g(x)$ I should make (1) equal to zero, and then re-arrange to get $x=$ . The simplest method being to just add $x$ to each side. So,
$$ 0=\cos(3x) \tag 3$$ $$ x=\cos(3x)+x \tag4$$
So how do I get from (4) to (2), or have I misunderstood something.
Thanks.
When we write:
$$x_{n+1} = g(x_n)$$
we need:
$$|g'(r)| \lt 1$$
for convergence, where $r$ is the actual root.
If we find an example root of $\cos 3x = 0$, we have $x = \dfrac{\pi}{6}$ (of course there are many given the periodic function).
If we calculate this for your choice of $g(x) = x + \cos(3x)$, we have:
$$\left|g'\left(\dfrac{\pi}{6}\right)\right| = \left|1 - 3 \sin\left(\dfrac{\pi}{2}\right)\right| = |-2| \implies ~ \mbox{diverges}$$
However, if we use their choice of $g(x) = \dfrac{2x+cos(3x)}{2}$, we have:
$$\left|g'\left(\dfrac{\pi}{6}\right)\right| = \left|1 - \dfrac{3}{2} \sin\left(\dfrac{\pi}{2}\right)\right| = \left|-\dfrac{1}{2}\right| \implies ~ \mbox{converges}$$
Indeed, for a starting point of $x_0 = 1$, this one converges to the root:
$$x = 0.5235987756$$
Of course, this is $\dfrac{\pi}{6}$.