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?
Asked
Active
Viewed 730 times
2
a06e
- 11,327
- 4
- 48
- 108
2 Answers
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
-
There is no way to bypass the computation of all the eigenvalues when you are only interested in the largest positive one? – a06e Jul 07 '17 at 14:04
-
-
0
This should do it:
Last@Sort@Cases[Transpose@Eigensystem@M,{_Real,__}]
TimRias
- 3,160
- 13
- 17
-
1It would be helpful to demonstrate the code by running in on
mgiven in other answers. – bbgodfrey Jul 07 '17 at 14:41
Eigensystem[M, 1]? – kglr Jul 07 '17 at 13:31