6
$\begingroup$

How do I find the solutions of tanx = x upto any number of decimals?

(Of course, there is the graphical method but it just helps in finding the approximate value...)

$\endgroup$
1
  • $\begingroup$ a related question: answerhttps://math.stackexchange.com/questions/1708389/matlab-newton-raphson-for-x-tanx $\endgroup$
    – IV_
    Jul 19, 2022 at 12:12

5 Answers 5

11
$\begingroup$

You know that there is a solution $x_k$ in a neighbourhood of $2 \pi k$, for each integer $k$.

And the equation can be also written as

$x_k = \arctan(x_k) + 2 k \pi$

where the arc tangent returns the principal value.

Then you can iterate:

$x_k[0] = 2 k \pi$

$x_k[n] = \arctan(x_k[n-1]) + 2 k \pi$

It converges very quickly - empirically - proof is left as an exercise :)

If you have an starting approximate value, you pick your $k$ by rounding $x_0/(2 \pi)$

enter image description here

$\endgroup$
1
  • $\begingroup$ This is a remarkably fast method. $\endgroup$ Sep 10, 2019 at 11:21
11
$\begingroup$

Apart from the solution $x=0$ there are for each $n>0$ two solutions $\pm x_n$ with $x_n={(2n-1)\pi\over2}-\tau_n$ where $\tau_n>0$ is $O({1\over n})$. It is easy to see that $\tau_n$ satisfies the equation $$\tau=\arctan{1\over (2n-1)\pi/2 - \tau}=:f(\tau).$$ As $|f'(\tau)|\ll1$ in the neighbourhood of $\tau=0$ we can obtain $\tau_n$ numerically by iterating $f$ starting at $\tau=0$.

$\endgroup$
9
$\begingroup$

Newton-Raphson solving for zeros of $f(x) = tan x - x$

$\endgroup$
2
  • $\begingroup$ with which starting points? $\endgroup$
    – lhf
    Jan 24, 2011 at 10:59
  • 4
    $\begingroup$ @lhf, he said he had an approximate value. $\endgroup$ Jan 24, 2011 at 11:21
6
$\begingroup$

Today, there was a question about the roots of $tan(x)=2x$

I cannot find it. May be this question was delated ?

Nevertheless, I found this question related to $tan(x)=x$ . So, my answer will be to both.

Of course, the roots are transcendantal numbers, which cannot be expressed in terms of a finite number of elementary functions. But they can be expressed on the forme of series :

enter image description here

$\endgroup$
2
  • $\begingroup$ This is amazing!! $\endgroup$
    – NeilRoy
    Sep 29, 2015 at 6:08
  • $\begingroup$ I also missed this one ! Sorry for that. $\endgroup$ Sep 2, 2019 at 10:35
1
$\begingroup$

(This should be a comment to leonbloy's answer)

The proper expression for the fixed-point iteration for the $n$th nonzero solution of $x=\tan\;x$ is $x_{k+1}=\arctan(x_k)+n\pi$. In fact, for the more general transcendental equation $\tan\;x=\lambda x$, the fixed-point iteration $x_{k+1}=\arctan(\lambda x_k)+n\pi$ works nicely; one can use the fixed point starting with $x_0=n\pi$ for the first few iterations and then switch to Newton-Raphson as soon as the fixed-point iteration has started converging. A similar fixed-point method works for the related transcendental equation $\cot\;x=\mu x$.

If one needs to compute large roots, it might be more profitable to construct asymptotic approximations to the roots; details are given in chapter 7 of the book Numerical Methods for Special Functions by Gil, Segura, and Temme.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .