Undesired complex number in the square root

Since symbolic calculations are better done with exact, rather than floating-point, numbers, the following was done with t = 1/10:

Eigenvalues[ham // ExpToTrig]
(*
  { 0,
   -Sqrt[2 + Cos[kx] + Cos[ky]]/(5 Sqrt[2]),
    Sqrt[2 + Cos[kx] + Cos[ky]]/(5 Sqrt[2])}
*)

Note: It will "work" with t = 0.1 but the factor in the denominator gets incorporated as Real coefficients in the square root:

(*
  { 0,
   -Sqrt[0.04 + 0.02 Cos[kx] + 0.02 Cos[ky]],
    Sqrt[0.04 + 0.02 Cos[kx] + 0.02 Cos[ky]]}
*)

Thus rationalizing 0.1 is not necessary, but one should be aware that round-off error often leads to problems in symbolic manipulation.


At least for this case, one can take an indirect route through CharacteristicPolynomial[]:

ham = Simplify[(# + ConjugateTranspose[#]) &[{{0, (-t)*(1 + Exp[(-I)*ky]), 0},
                                              {0, 0, (-t)*(1 + Exp[I*kx])},
                                              {0, 0, 0}}], {t, kx, ky} ∈ Reals]
   {{0, -(1 + E^(-I ky)) t, 0}, {-(1 + E^(I ky)) t, 0, -(1 + E^(I kx)) t},
    {0, -(1 + E^(-I kx)) t, 0}}

cp = FullSimplify[CharacteristicPolynomial[ham, λ], {t, kx, ky} ∈ Reals]
   λ (4 t^2 - λ^2 + 2 t^2 (Cos[kx] + Cos[ky]))

λ /. Solve[cp == 0, λ]
   {0, -Sqrt[2] t Sqrt[2 + Cos[kx] + Cos[ky]], Sqrt[2] t Sqrt[2 + Cos[kx] + Cos[ky]]}