# Obtain the largest positive eigenvalue (with its eigenvector)? [duplicate]

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?

• Eigensystem[M, 1]?
– kglr
Jul 7 '17 at 13:31
• @kglr That gives the largest eigenvalue according to absolute value. I want the largest positive eigenvalue (there might be another negative eigenvalue with larger absolute value that I do not want). Jul 7 '17 at 13:33
• becko, i see. thanks.
– kglr
Jul 7 '17 at 13:33

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}}

• There is no way to bypass the computation of all the eigenvalues when you are only interested in the largest positive one? Jul 7 '17 at 14:04
• @becko, good point. i can't think of any way.
– kglr
Jul 7 '17 at 14:11
• I figured out something that could work in some cases, see my answer. Jul 7 '17 at 14:15

This should do it:

Last@Sort@Cases[Transpose@Eigensystem@M,{_Real,__}]

• It would be helpful to demonstrate the code by running in on m given in other answers. Jul 7 '17 at 14:41