2

Eigenvalues[M,1] can be used to return the largest eigenvalue in absolute value. Is there a simple way to obtain the largest positive eigenvalue instead, as well as the corresponding eigenvector/s?

a06e
  • 11,327
  • 4
  • 48
  • 108

2 Answers2

2
evv = Module[{es = Eigensystem[#], ord}, ord = Ordering[-es[[1]]]; es[[All, ord[[1]]]]] &;


m = N[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}];    
evv @ m

{16.1168, {-0.231971, -0.525322, -0.818673}}

evv[-m]

{1.11684, {0.78583, 0.0867513, -0.612328}}

Update: Using the options in Jens's answer in the q/a linked by @Carl

evv2 = Eigensystem[#, 1, Method -> {"Arnoldi", "Criteria" -> "RealPart"}][[All,1]]&;
evv2@ m

{16.1168, {-0.231971, -0.525322, -0.818673}}

kglr
  • 394,356
  • 18
  • 477
  • 896
0

This should do it:

Last@Sort@Cases[Transpose@Eigensystem@M,{_Real,__}]
TimRias
  • 3,160
  • 13
  • 17