Numerical solution to x = tan (x) I needed to find, using the bisection method, the first positive value that satisfy $x = \tan(x)$. So I went to Scilab, I wrote the bisection method and I got $1.5707903$. But after some reasoning I came to the conclusion that this value is wrong:


$\tan(1.5707903) \approx 1.6x10^5$. Not even close to $1.5707903$.
Forget for a moment the above. $x = \tan(x)$ is actually to find fixed points of $f(x) = \tan(x)$; $(x, f(x))$ must be in the line $y = x$. Here is the plot:



In $(0, \frac{3}{2}\pi)$ I can only see a fixed point to the right of $x = 4$, therefore $1.5707903$ is wrong.

Here comes the interesting part. If you go to Wolfram Alpha and type $x = \tan(x)$, you will see $1.5708$ in the Plot section:


However there is no $1.5708$ in the Numerical solutions section. Wolfram Alpha found $0, \pm 4.49340945790906, \ldots$.

But if you type $\tan(x) = x$, you will not see $1.5708$ in the Plot section!:


To summarize:


Is $4.49340945790906$ the first positive value that satisfy $x = \tan(x)$?
Do you know why Wolfram Alpha is showing $1.5708$ as a solution when you type $x = \tan(x)$ but not when you type $\tan(x) = x$?


Thanks.
As you see from the plot of $\tan x$, you're intercepting the asymptote, which is not really the desired behavior. Bisection is not the best method to use.

However, if you're required to use bisection, then instead note that $\tan x = \frac{\sin x}{\cos x}$, so, for relevant values of $x$,

$$x = \tan x \implies x\cos x - \sin x = 0$$

The latter function is continuous, and you should get the desired solution of $x \approx 4.49$.
I have a MathLab code, which is based on bisection method; Here it is:

clc
clear
% zeros of equation x = tan(x);
% The roots of equation x=tanx by means of bisection method
% z  represents the root
% epsilon is error
% NR is the number of roots that you want; number of roots = 2*NR+1
% Max is the number of bisections

epsilon = 0.0001; 
NR = 2;
Max = 100;

g=@(x) x-tan(x);

for k = -NR:NR
    a = (2*k-1)*pi/2 + epsilon;
    b = (2*k+1)*pi/2 - epsilon;
    if feval(g,a)*feval(g,b) &lt; 0 
            for j=1:Max
             z = (a+b)/2;
                    if (feval(g,a)*feval(g,z) &lt; 0)
                       b=z;
                    elseif (feval(g,a)*feval(g,z) > 0)
                       a=z;
                    end
            end
            if feval(g,z) &lt; epsilon %error
            z
            end
    end
end

% outputs for NR=2 are :    -7.7253 ,    -4.4934 , 0 ,     4.4934 ,     7.7253