How to find the root of $x-\cot{x} = 0$ by fixed-point iteration?

128 Views Asked by At

I have to find the root of such equation with accuracy $0.2$ by fixed-point iteration method: $$ x-\cot{x} = 0 $$ So I have: $$ f(x) = x-\cot{x} $$ $$ g(x) = \cot{x} $$ For $x_0$ I choose $-0.9$ and then I have $x_1=-0,794$ and that's okay, but if I will continue the values will rising rapidly without convergation. What am I doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

By $x\tan x=1$ one can see that at $x=1$ the left side is above $1$, and at $x=\frac\pi4$ it is below, giving a bracketing interval for the solution.

Set $x=\frac\pi4+y$ with $y$ small. Then $$ \frac\pi4+y=\frac{\cos y -\sin y}{\cos y+\sin y}\approx\frac{1-y}{1+y}\approx 1-2y. $$ So taking the last variant gives $3y\approx1-\frac\pi4$ so $x\approx \frac{\pi}{6}+\frac13$. This gives numerical values of $x=0.857$ and $\cot x=0.866$, thus within the desired accuracy.


If $x$ is close but below the target value, then $\cot x$ will be above and vice versa. So the weighted midpoint formula cancelling the linear terms at about $x=\frac\pi4$, $$ x_{+1}=g(x)=\frac{2x+\cot x}3, $$ has also good chances to work well. This indeed converges linearly with factor about $0.087$.

         x[k]              dx[k]=x[k]-x[k-1]     c[k] = dx[k]/dx[k-1]
 ---------------------------------------------------------------------
  0.7853981633974483,  
  0.8569321089316322,   0.07153394553418391, 
  0.8600447897988722,   0.0031126808672400363,   0.04351333963191755 
  0.8603086181305376,   0.00026382833166538333,  0.08475919727013828 
  0.8603314266342151,   2.28085036775294e-05,    0.086452063482165 
  0.860333401740334,    1.9751061188788555e-06,  0.08659516410209323 
  0.8603335727994016,   1.7105906757741707e-07,  0.08660753259906695 
  0.8603335876145884,   1.4815186855088314e-08,  0.08660860289316923 
  0.8603335888977126,   1.2831241624766676e-09,  0.08660870598712532 
  0.8603335890088424,   1.1112977205129937e-10,  0.08660874395568882 
  0.8603335890184671,   9.624745445080407e-12,   0.0866081632979276 
  0.8603335890193007,   8.335554468885675e-13,   0.08660545379043048],
  0.860333589019373,    7.227551890309769e-14,   0.08670751198721365],
  0.8603335890193792,   6.217248937900877e-15,   0.08602150537634409],
  0.8603335890193797,   5.551115123125783e-16,   0.08928571428571429],