2
$\begingroup$

I have a huge sparse matrix and I want to have the smallest eigenvalue and its corresponding eingenvector. I use this code (a used a smaller matrix for the example):

A = {{1,0,0},{0,-2,0},{0,0,5}};
{val,vec}  = Eigensystem[A,-1];
Print[val];
Print[vec];

I want to have -2 and {0,1,0} as output, but instead I get the eigenvalue with the lowest magnitude, here 1 and {1,0,0}. Is there a way to get the eigenvalue with the lowest value?

$\endgroup$
5
  • $\begingroup$ Surprisingly, the "Criteria" suboption seems to be completely ignored in the exact case... $\endgroup$ – J. M.'s ennui Mar 18 '16 at 12:29
  • $\begingroup$ @Henry Do you mean something like this {m = Min[val], vec[[Position[val, m][[1, 1]]]]} $\endgroup$ – Dr. Wolfgang Hintze Mar 18 '16 at 12:53
  • $\begingroup$ First@Sort[Transpose[Eigensystem[A]]] $\endgroup$ – george2079 Mar 18 '16 at 14:00
  • $\begingroup$ (1) Pick a value that is larger than the most negative eigenvalue (use whatever convenient bound). (2) Find the eigenvalue closest to its negative. I'll show this with 10 as my choice. In[1705]:= A = {{1, 0, 0}, {0, -2, 0}, {0, 0, 5}}; {val, vec} = Eigensystem[A + 10*IdentityMatrix[3], -1] + {-10, 0} Out[1706]= {{-2}, {{0, 1, 0}}} $\endgroup$ – Daniel Lichtblau Mar 18 '16 at 15:47
  • $\begingroup$ Alternatively and maybe more reliably: In[1709]:= A = {{1, 0, 0}, {0, -2, 0}, {0, 0, 5}}; {val, vec} = Eigensystem[A - 10*IdentityMatrix[3], 1] + {10, 0} Out[1710]= {{-2}, {{0, 1, 0}}} (I'd figure out which is the better way to go about this, but I need more coffee...) $\endgroup$ – Daniel Lichtblau Mar 18 '16 at 15:50
1
$\begingroup$

What about this?

This is your matrix.

A = {{1, 0, 0}, {0, -2, 0}, {0, 0, 5}};

We consider a table of all eigenvalues, and then find the position of minimum.

myDesiredPosition = Position[Eigenvalues[A], Min[Eigenvalues[A]]];

From eigenvectors table, we call the one corresponding to position calculated in previous step.

Eigenvectors[A][[myDesiredPosition[[1]]]]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.