4

$g(x)=(2/3)(\cos x-\sin x)$

$x_n=g(x_{n-1})$

with initial guess $x_0=1$

I need to compute for n= 0,1,...,8

When I try it, my sequence diverges: $x_1=-0.20078$, $x_2=0.78623$, $x_3=-0.00079$, etc...

In a following question, I'm meant to compare it to Aitken's and see which one converges faster but it's not converging at all.

4 Answers4

5

The results you obtain are quite oscillatory and it seems it does not converge. But it does!

Plot

AugSB
  • 5,007
  • 1
    That's very odd! I should have noticed they were coming closer instead of moving away. Thanks for the insight! The graph is also very visually pleasing :) – user314580 Mar 11 '16 at 11:44
  • @user314580 If you like this answer, you should upvote it. I did. If you evaluate $g'$ at the fixed point, by the way, you get a negative number which explains the oscillations. – Mark McClure Mar 11 '16 at 11:51
  • Yeah I was concerned about it oscillating away instead of converging because that was the only time I had seen oscillations. Oddly it works here though. Thanks! – user314580 Mar 11 '16 at 12:00
2

Since $|g'(x)| \le \dfrac{2 \sqrt2}{3} $ for all $x$, the iteration of $g$ converges for all initial points to a fixed point of $g$.

There is only one fixed point, which is approximately $x^*=0.37562$.

Since $\dfrac{2 \sqrt2}{3} \approx 0.94$ is close to $1$, the converge may be slow.

In fact, $|g'(x^*)|\approx 0.86$, which is better than $0.94$.

lhf
  • 216,483
2

As a first approximation, the function is linear in the targeted range, with a negative slope.

The equation

$$x_n=ax_{n-1}+b$$ has the general solution

$$x_n=ca^n+\frac b{1-a}.$$

enter image description here

So it converges as $|a|<1$ (empirically, $a=-0.85$), with an oscillatory behavior because $a<0$. The absolute value of the error is strictly decreasing. It takes a little more than four iterations to halve it.

0

I tried with initial guess as x0=25 (yes twenty five. just an arbitrary wild guess) but it does converged to the root of the equation which is 0.375620350623..... Even with your initial guess, the result does converges but takes more number of iterations if we start with my guess as well as your guess as explained by one of above answer.