How to get exact number for repeated eigenvalue in MATLAB and R Following matrix has repeated eigenvalue $1$.

$$
\begin{pmatrix}
  8  &amp;  -2  &amp;   1  &amp;  -1 \\
    23  &amp;  -6  &amp;   3  &amp;  -3 \\ 
    -4  &amp;   1  &amp;   1  &amp;   1 \\
    -4  &amp;   2  &amp;   0  &amp;   1
\end{pmatrix}
$$

How to get $1$ instead of:
$$
\underbrace{
\begin{pmatrix}
   0.9997 + 0.0000i \\
   1.0000 + 0.0003i \\
   1.0000 - 0.0003i \\
   1.0003 + 0.0000i
\end{pmatrix}}_{\text{MATLAB: eig(A)}}
\qquad\qquad
\underbrace{
\begin{pmatrix}
   1.0002024+0.0002024i \\
   1.0002024-0.0002024i \\
   0.9997976+0.0002024i \\ 
   0.9997976-0.0002024i
\end{pmatrix}}_{\text{R: eigen(A)}}
$$
For Octave users, OctSymPy is a symbolic package which try to be compatible with SMT unless otherwise specified. It also claims to work on Matlab, but I don't use Matlab, so I cannot test it. (Please file a bug if it doesn't!)

To run your example, simply type (This should also work on SMT):

eig(sym([8 -2 1 -1; 23 -6 3 -3; -4 1 1 1; -4 2 0 1]))


A screenshot showing the result:


Feel free to ask if you don't understand something.
You're working with floating point arithmetic, so unless you use a symbolic package, there's going to be some incorrect digits.  You could set a tolerance and round to the nearest whole number, but that may impact your computation of other eigenvalues.  In Matlab, you could round to the second digit by way of:

round(1.003 + 0.0031i,2)


Edit: why the downvote, was something I said incorrect?