# Get rid of imaginary parametric eigenvalues of a Hermitian matrix

I have four matrices with below structures (mat1, mat2, mat3 and mat4). With real coefficients (c1, c2, c3) I have created the matrix matcomplete=(mat1+c1*mat2)+c3*(mat3+c2*mat4). All mat's are Hermitian matrices. I know in this case of real coefficients (as it is the my case), matcomplete will be Hermitian. Then the eigenvalues of matcomplete have to be real. But when I use of here method:

Eigenvalues[matcomplete, Cubics -> True]


the some eigenvalues will be Imaginary. I mean in one term I see

 (*  ((1 + I Sqrt[3])  *)


I wanted to use of FullSimplify[Eigenvalues[matcomplete, Cubics -> True], Assumptions{c1>0,c2>0,c3>0}] but it has taken too long!!.

There are some assumptions (but I think the third is true):

1-Eigenvalues of a Hermitian matrix such as matcomplete maybe are not always real.

2- matcomplete is not a Hermitian matrix even with real coefficients.

3-Eigenvalues[matcomplete, Cubics -> True] is not a good way for these matrices.

How can I reach to the correct eigenvalues of the matcomplete? here introduces a method that has been suggested by Feyre. It means that one way is use of numeric values but I have to obtain eigenvalues parametricaly.

    mat1={{0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0,0,
0, 1, 1, 0, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1,
0, 0, 1, 0}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, {0,
0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 0, 1,
0, 0, 1, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1}, {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0}, {0, 1,
0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1}, {0, 0, 0, 1, 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0, 0, 0,
0}, {0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, {1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, -1, 0, 0, 0, 0, 0, 0,
0, 0, -1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0,
0}, {0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, -1,
0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1}, {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
0}, {0, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 0}, {0, 0, 0,
0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, -1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0}};

• I ran the FullSimplify[], and it still contains complex values, note that substituting in real positive values for the constants also still gives complex values. Commented Aug 16, 2016 at 11:07
• This is a cancellation error: ret = Eigenvalues[newmat, Cubics -> True]; Manipulate[ Chop[N[ret] /. {c1 -> a1, c2 -> a2, c3 -> a3}], {a1, 0, 10, 0.1}, {a2, 0, 10, 0.1}, {a3, 0, 10, 0.1}] // MatrixForm Commented Aug 16, 2016 at 11:16
• @ Feyre, I think I cannot understand a thing! You added Chop and look numerically to eigenvalues. But no eigenvalues are complex. Commented Aug 16, 2016 at 12:57
• Again we have the casus irreducibilis situation for radical solutions of the cubic. I'd suggest use Root form, it's better anyway. Commented Aug 16, 2016 at 14:34
• Possible duplicate of How to get the correct answer of this expression with Minimize?
– Jens
Commented Aug 16, 2016 at 16:28

You can simply ignore the fact that you are seeing a (1 + I Sqrt[3]). Let's have a look at the last eigenvalue where this thing appears.
eval = Eigenvalues[matcomplete, Cubics -> True][[-1]]

and you can see $1-i\sqrt3$ and also $1+i\sqrt3$. Now Mathematica can not simplify it because it does not know the values of c1,c2,c3 so it can not evaluate the square roots and cube roots. Specifying c1,c2,c3 to be Reals or $>0$ is not sufficient because it does not specify the value of the terms inside the roots. But when you specify the exact values, it can evaluate those terms and the imaginary parts cancels each other explicitly and you get real eigenvalues. May be with some luck and trials you can find a condition which can get read of the imaginary part in this parametric form - I am too lazy for that.