# Math Help - solving the equation tan(x)=1/x

1. ## solving the equation tan(x)=1/x

Hi, again!
a few months ago I post that question , but I need to solve it (numerically, of course, I don't know about analytic way...) by using Maple Or Matlab.

My question:
tan(dx)=h/(k*x)
when d, h and k are constants!

I need to find all the solutions (as close as possible).

Thanks (:
RedFox.

2. Hello, Red!

A few months ago I posted: $\tan x \,=\,\frac{1}{x}$
but I need to solve it (numerically, of course) by using Maple or Matlab.

My question: . $\tan(dx)\:=\:\frac{h}{kx}$ with constants $d,\;h,\;k.$

I need to find all the solutions (as close as possible).

Since $\frac{h}{k}$ is a constant, your equation is: . $\tan(ax) \:=\:\frac{b}{x}$

I would graph: . $y \:=\:\tan(ax)$ and $y \:=\:\frac{b}{x}$
. . and locate their intersections.

3. Originally Posted by Red_Fox
Hi, again!
a few months ago I post that question , but I need to solve it (numerically, of course, I don't know about analytic way...) by using Maple Or Matlab.

My question:
tan(dx)=h/(k*x)
when d, h and k are constants!

I need to find all the solutions (as close as possible).

Thanks (:
RedFox.
Here is a method that would give some of the solutions.
Rewrite Soroban's equation as,
$x\sin (ax)=b\cos (ax)$
Approximate,
$ax^2-\frac{a^3x^4}{3!}+\frac{a^5x^6}{5!}=b-\frac{a^2bx^2}{2!}+\frac{a^4bx^4}{4!}$
This is a polynomial equation.
There should be a polynomial solving program in the software you are using.

4. Originally Posted by Red_Fox
Hi, again!
a few months ago I post that question , but I need to solve it (numerically, of course, I don't know about analytic way...) by using Maple Or Matlab.

My question:
tan(dx)=h/(k*x)
when d, h and k are constants!

I need to find all the solutions (as close as possible).

Thanks (:
RedFox.
Absorb the constants to give:

$
\tan(\delta .x)=m/x
$
,

where $m=h/k$, also put $y=\delta .x$, then we are interested in the solutions of:

$\tan(y)=n/y$,

where now $n=\delta .h/k$.

Now when $n \ne 0$ this obviously (if I have done this right) has a solution
in each of the intervals $(0, \pi/2)$, $(-\pi/2, 0)$, $(((k+1)\pi, (2k+3)\pi /2)$,
$(-(2k+3)\pi/2, -(k+1)\pi)\ k=0,\ 1,\ ..$.

Also for large $k$ the roots approach $(k+1) \pi$
(with the mirror image roots when $k$ is negative).

Now numerical methods can be used to find the root in any particular
interval (since we know the interval that a root lies in I would use binary
search for this, though Newton-Raphson is probably faster)

RonL

5. ## well...

first of all, thank you guys very much!
few things:

1. [ThePerfectHacker] Do you the this approximation can give me solutions that are close enough to the orginal problem? (I will sure try, however).

2. [CaptainBlack] Why I have to check this intervals? and do you think I can do it by myself? (I mean, with newton-raphson method, without matlab/maple)?

Thanks again!

6. Originally Posted by Red_Fox
2. [CaptainBlack] Why I have to check this intervals? and do you think I can do it by myself? (I mean, with newton-raphson method, without matlab/maple)?
Matlab/maple will use NR or something similar. I would not expect you to
find the solutions by hand unless it was set as homework. If you have
matlab/maple then use it/them, you could also use the solver in Excel,
or whatever tool is easiest.

RonL

7. Originally Posted by Red_Fox

1. [ThePerfectHacker] Do you the this approximation can give me solutions that are close enough to the orginal problem? (I will sure try, however).
Based on experience I would say to 2 decimal places.
If you are familiar with Taylor polynomials you can increase their sizes for sine and cosine.

8. Originally Posted by CaptainBlack
Absorb the constants to give:

$
\tan(\delta .x)=m/x
$
,

where $m=h/k$, also put $y=\delta .x$, then we are interested in the solutions of:

$\tan(y)=n/y$,

where now $n=\delta .h/k$.

Now when $n \ne 0$ this obviously (if I have done this right) has a solution
in each of the intervals $(0, \pi/2)$, $(-\pi/2, 0)$, $(((k+1)\pi, (2k+3)\pi /2)$,
$(-(2k+3)\pi/2, -(k+1)\pi)\ k=0,\ 1,\ ..$.

Also for large $k$ the roots approach $(k+1) \pi$
(with the mirror image roots when $k$ is negative).

Now numerical methods can be used to find the root in any particular
interval (since we know the interval that a root lies in I would use binary
search for this, though Newton-Raphson is probably faster)

RonL
We may refine our estimate of the root near $k \pi,\ k \in \mathbb{N}$ for large $k$ (I will assume $k$ is poitive,
the negative roots are all reflections of the poitive roots about $0$), as near $k \pi;\ \tan(x)\approx x-k\pi$.

So for large $k$ the root near $k \pi$ of:

$
\tan(x)=\frac{n}{x}
$
,

is close to the root of:

$
x-k \pi=\frac{n}{x}
$
,

which on rearrangement is:

$
x^2-k \pi x-n=0
$
,

which has roots:

$
x=\frac{k \pi \pm \sqrt{k^2\pi^2+4n}}{2}
$

of these roots we need the positive one so:

$
x=\frac{k \pi + \sqrt{k^2\pi^2+4n}}{2}
$
.

or:

$
x=\frac{k \pi}{2} (1 + \sqrt{1+4n/(k^2 \pi^2)})
$
.

Now expanding the square root as a power series and truncating after the
first term gives:

$
x \approx k \pi + \frac{n}{k \pi}
$

Now for some examples:

$
\begin{array}{ccccc}
k&n&k \pi & k \pi+n/(k \pi)&root\\
5&20&15.71&16.98&16.59\\
5&2&15.71&15.84&15.83\\
10&2&31.42&31.48&31.48
\end{array}
$

RonL

9. Red_Fox, I have an algorithm you will most appreciate. Have you ever heard of the Newton-Raphson method?
If you did, the obvios problem is to get make it produce a solution of some interval. Whenever, you use the newton-raphson method it not always gives you the solutions you are looking for, in order to avoid this look at this post. CaptainBlank did the important work by isolating all the intervals where exactly one solution exists. This is true because, $f(x)=\tan (x)$ and $g(x)=1/x$ intersect at the points shown below. Note the positive solutions exist uniquely in each period of the tangent curve, which justifies CaptainBlank result.

10. Originally Posted by ThePerfectHacker
Red_Fox, I have an algorithm you will most appreciate. Have you ever heard of the Newton-Raphson method?
I should hope so, its been mentioned at least twice already in this thread!

RonL

11. ## Well...

I have nothing left to say!
Yeah, I suppose NR is good enough. I know this method, but I was not sure about using it.
Thank u so much guys! You helped me a lot (: