1
$\begingroup$

SO I have this code:

{evalueb1,evectorsb1} = Eigensystem[Coefficientsp1];
 evalueb1 = 1/(evalueb1*2\[Pi]);

 For[i=1,i<(2TruncationOrder+1),i++,If[Abs[Im[evalueb1[[i]]]]                                            
 <10^-14,evalueb1[[i]]=Re[evalueb1[[i]]],evalueb1[[i]]=evalueb1[[i]]]];

 \[Rho]plus1 = Sort[Select[evalueb1,Im[#]>0\[Or](Im[#]==0\[And]Re[#]>0)&],Im[#2]>Im[#1]&];
 \[Rho]minus1 = Sort[Select[evalueb1,Im[#]<0\[Or](Im[#]==0\[And]Re[#]<0)&],Im[#2]Im[#1]&];

What I did was sort the eigenvalues based on the sign of the complex part. How can I make it so that I can find the correct eigenvector associated with the sorted eigenvalues?

$\endgroup$
  • $\begingroup$ Why not pair up your eigenvalues and eigenvectors, and then sort those pairs? $\endgroup$ – J. M. will be back soon May 23 '13 at 18:39
  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/q/7679/5 $\endgroup$ – rm -rf May 23 '13 at 18:41
  • $\begingroup$ How could I do that? I sort the eigenvalues based on which Imaginary part is smaller. Would that change the eigenvalues as well? $\endgroup$ – yankeefan11 May 23 '13 at 18:42
  • $\begingroup$ I also use Select[] to pick certain eigenvalues. So could I pair them up some how and pick an eigenvector with the eigenvalue? $\endgroup$ – yankeefan11 May 23 '13 at 18:47
  • $\begingroup$ Have you seen the post rm linked to? (It would now seem that this is a dupe of that question.) $\endgroup$ – J. M. will be back soon May 23 '13 at 18:48

Browse other questions tagged or ask your own question.