1
$\begingroup$

Suppose I have a complex hermitian matrix, M[x_,y_] whose eigenvalues must be real.I tried to minimize the first eigenvalue by writing following command:f[x_,y_]:=Eigenvalues[M[x,y]][[1]]; Minimize[f[x,y],{x,y}]

But the error shows: Minimize::The objective function f[x,y] contains a nonreal constant -I. Can somebody kindly solve my problem?

$\endgroup$
  • 1
    $\begingroup$ Without knowing the matrix M it's difficult to debug this. At the very least you should constrain the patterns on f: f[x_?NumericQ, y_?NumericQ] := .... This ensures the eigenvalues only get evaluated for numeric inputs. You should also ensure that the returned value of f is always real. The appropriate function for minimizing this problem is NMinimize. Finally, you probably want to use First @ Eigenvalues[M[x,y], 1] to make sure Eigenvalues only computes the largest eigenvalue. $\endgroup$ – Sjoerd Smit Aug 22 at 9:00
  • $\begingroup$ Thanks for your reply. The Hamiltonian is: H[ a_, x_]: = {{0., -Exp[I*(a + x)], -Exp[Ix] - 1, Exp[Ia]},{-Exp[-I*(a + x)], 0., Exp[Ia], -Exp[Ix] - 1},{-Exp[-Ix] - 1, Exp[-Ia], 0., -Exp[I*(a - x)]},{Exp[-Ia], -Exp[-Ix] - 1, -Exp[-I*(a - x)], 0.}} ; The NMinimize works fine. Thanks. $\endgroup$ – atanu Aug 22 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.