How to find the roots of the Equation

9 views (last 30 days)
I was trying to find the roots of the equation
tan(x/2)+tanh(x/2)=0.
Can anybody help me in finding the roots.

Accepted Answer

John D'Errico
John D'Errico on 31 Dec 2019
This question gets asked so often, that it must be part of a homework or something.
fplot(@(x) tan(x/2)+tanh(x/2),[-10,10])
grid
yline(0);
untitled.jpg
There are infinitely many real roots. You can see three of them in the figure. They will surely not have any simple algebraic form you can write down. There may be complex roots, in fact, that is entirely possible. You could investigate that behavior by plotting things very carefully in the complex plane. How?
Hr = fcontour(@(xr,xi) real(tan((xr + i*xi)/2)+tanh((xr + i*xi)/2)),[-10,10,-10,10]);
Hr.LevelList = 0;
Hr.LineColor = 'b';
hold on
Hi = fcontour(@(xr,xi) imag(tan((xr + i*xi)/2)+tanh((xr + i*xi)/2)),[-10,10,-10,10]);
Hi.LevelList = 0;
Hi.LineColor = 'r';
grid
untitled.jpg
So it appears there are solutions in the complex plane. However, they exist only when x is purely real, OR purely imaginary. Those solutions lie at the intersections of the red and blue curves as I have plotted them. It appears that no solutions exist with simultaneously non-zero real and imaginary parts. With some effort, you could probably prove that claim, but it hardly seems worth the effort.
Actually finding any of the solutions for real or imaginary x will involve nothing more than use of a root finder, suze as fzero or vpasolve. Again, the solution that you find will depend on the start point or the starting interval. Here are three arbitrarily found real solutions.
syms x
vpasolve(tan(x/2)+tanh(x/2),x)
ans =
0
vpasolve(tan(x/2)+tanh(x/2),x,5)
ans =
4.730040744862704026024048100833884819898
vpasolve(tan(x/2)+tanh(x/2),x,12)
ans =
10.99560783800167090666903251910589241754
I seem to recall, from the last time I answered this question, that the roots approach a periodic behavior for large or small x. There will be some multiple of pi involved as I recall. This too can surely be shown, with some effort that may not be worth the effort invested for what is surely a homework assignment.
  1 Comment
Walter Roberson
Walter Roberson on 31 Dec 2019
tanh(x/constant) approaches 1 pretty quickly, so you can form good approximations to it by solving tan(x/2)+1 == 0, which is x/2 = atan(-1) and x = 2*atan(-1) . atan(-1) is -pi/4 + k*pi for integer k, so the solutions approach 2*k*pi - pi/2

Sign in to comment.

More Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 29 Dec 2019
Edited: KALYAN ACHARJYA on 29 Dec 2019
See solve function here (Must Recomended)
syms x;
fun=tan(x/2)+tanh(x/2)==0
S=solve(fun,x)
  5 Comments
Walter Roberson
Walter Roberson on 31 Dec 2019
Use vpasolve() and give a complex guess.
However, there are an infinite number of real and complex roots, that are approximately (but not exactly) 2*Pi apart from each other.

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!