0

Iterative method For $x=\phi(x)$ , $x_{n+1}=\phi(x_n)$

$x\sin x+\cos x=0$

$[x=2.7984]$

I tried the following forms but they are not provide solution

$x=\arccos(-x\sin(x))$

$x=\arcsin(\cos(x)/x)$

$x=\operatorname{arccot}(-x)$

$x=-\cot(x)$

$x=x+x\sin x+\cos x$

What is the general way to try to write $x=\phi(x)$ in programming?

  • There is no general way. However, there is a general way to check whether a given $f$ will work: verifying that it is a contraction. Google "Banach Fixed Point Theorem" or "Contraction mapping theorem" – Bananach Jan 16 '18 at 10:40
  • @Bananach for this problem what is the $\phi(x)$ – Smart Manoj Jan 16 '18 at 10:45
  • if you want to solve $g(x)=0$, there are infinitely many ways to rewrite this as a fixed point equation in the form $x=f(x)$. There is no general way to find the 'best' $f$. An obvious choice of $f$ is $f(x):=g(x)+x$. (My $f$ is your $\phi$, but you seem to use $f$ and $\phi$ interchangeably. Maybe you can fix that?) – Bananach Jan 16 '18 at 10:46
  • @Bananach I tried that also but $\phi'(x) \nless 1 $ – Smart Manoj Jan 16 '18 at 10:52
  • You tried what also? My "obvious choice"? Did you check the derivatives of all the other possible choices? Even if the derivatives are large for large arguments, you can often show that $\phi$ (I would have preferred $f$, since I cannot edit my old comments, but nevermind) maps a bounded region to itself, and in this case it suffices to have $|\phi'|\leq C<1$ in that bounded region – Bananach Jan 16 '18 at 11:05
  • Finally, unless this is a homework problem where you have to use fixed point methods, you can try Newton's method – Bananach Jan 16 '18 at 11:06
  • @Bananach i tried using g(x)+x as u mentioned but that also failed for $|\phi(x) < 1|$.I solved using Newton's method.I just need to know is it solvable using this method {P.S Not a homework problem} – Smart Manoj Jan 16 '18 at 11:21
  • 1
    I cannot help you anymore then (by the way, as far as I know abbreviating "you" with "u" and using slang in general is not seen favorably on this site) – Bananach Jan 16 '18 at 11:43
  • @Bananach sry -cot(x) itself provided the answer – Smart Manoj Jan 16 '18 at 15:31

1 Answers1

1

It usually helps when the iteration function provides some visual compression from domain to range. While $$ x=ϕ(x)=-\frac{\cos x}{\sin x}=-\cot x $$ will expand finite intervals to the full real line, due to the periodic poles of the cotangent function, the branches $$ x=ϕ_k(x)=k\pi-\text{arccot}(x) $$ of the inverse function will have the opposite effect, mapping the full real line to the finite interval $(\,(k-1)\pi,k\pi\,)$. Starting the iteration in the middle of that interval a test of the iteration can be implemented as

k = np.arange(-5,6,1)
x = (k-0.5)*np.pi
for j in range(10): print j,x; x = k*np.pi-np.arctan2(1,x)

with the results

0 [-17.27875959 -14.13716694 -10.99557429  -7.85398163  -4.71238898 -1.57079633   1.57079633   4.71238898   7.85398163  10.99557429 14.13716694]
1 [-18.79174588 -15.63734536 -12.47567444  -9.29813542  -6.07408066 -2.57468115   2.57468115   6.07408066   9.29813542  12.47567444 15.63734536]
2 [-18.79639121 -15.64410076 -12.48638564  -9.31764132  -6.12001504 -2.77112818   2.77112818   6.12001504   9.31764132  12.48638564 15.64410076]
3 [-18.79640433 -15.64412826 -12.48645396  -9.3178639   -6.12121835 -2.79527254   2.79527254   6.12121835   9.3178639   12.48645396 15.64412826]
4 [-18.79640437 -15.64412837 -12.48645439  -9.31786643  -6.12124963 -2.79803313   2.79803313   6.12124963   9.31786643  12.48645439 15.64412837]
5 [-18.79640437 -15.64412837 -12.4864544   -9.31786646  -6.12125045 -2.79834608   2.79834608   6.12125045   9.31786646  12.4864544  15.64412837]
6 [-18.79640437 -15.64412837 -12.4864544   -9.31786646  -6.12125047 -2.79838152   2.79838152   6.12125047   9.31786646  12.4864544  15.64412837]
7 [-18.79640437 -15.64412837 -12.4864544   -9.31786646  -6.12125047 -2.79838553   2.79838553   6.12125047   9.31786646  12.4864544  15.64412837]
8 [-18.79640437 -15.64412837 -12.4864544   -9.31786646  -6.12125047 -2.79838599   2.79838599   6.12125047   9.31786646  12.4864544  15.64412837]
9 [-18.79640437 -15.64412837 -12.4864544   -9.31786646  -6.12125047 -2.79838604   2.79838604   6.12125047   9.31786646  12.4864544  15.64412837]

showing rapid convergence.

Lutz Lehmann
  • 126,666