0

I have a 900x900 matrix to diagonalize. After diagonalizing it, I have a table of eigenvalues and eigenvectors. For convenience, I start with 3x3 matrix.

A = N[{{5, 0.1, 0.1}, {2, 60, 1}, {1, 0, 9}}]

Its eigenvalues and eigenvector are:

TableForm[Eigensystem[A]]

Here I have three eigenvalue which is

{60.003, 9.024, 4.971}

and the three eigenvectors respectively.

{-0.001818122243425529, -0.9999983465790367, -0.000035646889249054265}
{0.0243252697816448, -0.0205616388684505, 0.9994926214120311}
{-0.9700753102787193, 0.030880967853586353, 0.2408324276588856}

For each vetor, I want to determine the position of the biggest coefficient (in magnitude) and numbering it. For the above example, the biggest coefficient of each one is at: position 2 (the middle of the first vector), position 3 (the last element of the second vector), position 1 (the first element of the third vector). Then after that, I want the corresponding eigenvalues to be listed in the order of 1,2,3 which means 4.971 goes first and then 60.003 and finally 9.024. Do you guys have any method to do it since when I expand it to 900x900 I can not keep track of them anymore. Thank you.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Quang Phan
  • 111
  • 8

2 Answers2

4

Set your matrix and take the eigensystem:

a = {{5, 0.1, 0.1}, {2, 60, 1}, {1, 0, 9}};
{eigVal, eigVec} = Eigensystem[a];

Find the max values in each eigenvector, and find their positions in order:

maxes = Max /@ Abs[eigVec];
ord = Flatten@Table[Position[Abs[eigVec[[i]]], maxes[[i]]], {i, Length[eigVal]}]

{2, 3, 1}

Then use the ordering to permute the eigenvalues

Permute[eigVal, ord]

{4.97199, 60.0037, 9.02434}
bill s
  • 68,936
  • 4
  • 101
  • 191
1
Sort[MapThread[{First@Ordering[-Abs[#2], 1], #1} &, 
   Eigensystem[A]]][[All, 2]]

{4.97199, 60.0037, 9.02434}

george2079
  • 38,913
  • 1
  • 43
  • 110
  • Thank you, I try it with my big matrix. I roughly check the result. Some of them are in the wrong order. Could it be any modifications for big matrix? – Quang Phan Jul 27 '16 at 16:21
  • can you see if it works or not with a modest size matrix (maybe 10x10) that you can post? Also, You do realize your procedure is not guaranteed a unique result, ie its possible (for a large matrix quite likely) that multiple eignevectors will have their largest component in the same position. – george2079 Jul 27 '16 at 16:54