I can't find guidance in the documentation center for how to retrieve the eigenvector(s) of a matrix associated to a specific eigenvalue. My first question is what the command is to do that. I would next like to apply that function to a list (I want all the eigenvectors associated to 0 in a list of matrices). Any help is appreciated.


closed as off-topic by Daniel Lichtblau, Henrik Schumacher, N.J.Evans, eyorble, MarcoB Jun 23 '18 at 4:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Daniel Lichtblau, Henrik Schumacher, N.J.Evans, eyorble, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ What about NullSpace /@ matrices? $\endgroup$ – Henrik Schumacher Jun 21 '18 at 22:14
  • $\begingroup$ NullSpace? For other eigenvalues, Eigensystem gives a matching pair of eigenvalues and -vectors, so you can find the index of the eigenvalue you want and extract the corresponding eigenvector. $\endgroup$ – Marius Ladegård Meyer Jun 21 '18 at 22:15
  • $\begingroup$ Thank you, NullSpace is perfect here since I'm looking for 0 and works. What if I wanted it for something else, say 1? How would I apply that to a list in a quick way? With the map function? $\endgroup$ – massy255 Jun 21 '18 at 22:17
  • 1
    $\begingroup$ Or Extract[#[[2]], Position[#[[1]], 1.]] &@*Eigensystem /@ matrices. $\endgroup$ – Henrik Schumacher Jun 21 '18 at 22:20
  • $\begingroup$ @JungHwanMin at that point why not just use Eigensystem and then Pick[#[[2]], #==testVal&/@#[[1]]] $\endgroup$ – b3m2a1 Jun 21 '18 at 22:20

Converting comment into answer:

You could define a function like this:

eigenAssoc[matrix_] := Apply[Last, GroupBy[Thread[Eigensystem[matrix]], First], {2}]

For example:

In[1]:= assoc = eigenAssoc[{{2, 0, 0}, {0, 1, 0}, {0, 0, 2}}]

Out[1]= <|2 -> {{0, 0, 1}, {1, 0, 0}}, 1 -> {{0, 1, 0}}|>

Then you can use the resulting association to find the eigenvectors associated with an eigenvalue:

In[2]:= assoc[1]

Out[2]= {{0, 1, 0}}

If you expect to search some non-eigenvalue, then you may want to use Lookup:

In[3]:= Lookup[assoc, 3, {}]

Out[3]= {}
  • $\begingroup$ How do I apply assoc[1] to a list? Say I have Blocks = {{{1, 0}, {0, 5}}, {{-1, 3}, {0, 3}}, {{2, 2}, {0, 1}}}. eigenAssoc/@Blocks works fine, but not assoc[1]/@Blocks $\endgroup$ – massy255 Jun 24 '18 at 6:03
  • $\begingroup$ @massy255 You could define a pure-function, like eigenAssoc[#][1]& /@ Blocks. $\endgroup$ – JungHwan Min Jun 24 '18 at 6:17
  • $\begingroup$ Thanks! How would I modify it so that it gives me an empty set when there is no desired eigenvector for one of the blocks? For example on the above it gives me {{{1, 0}}, Missing["KeyAbsent", 1], {{-2, 1}}}. (I would like to eventually union this set at the end of the day to get the whole eigenspace. $\endgroup$ – massy255 Jun 24 '18 at 6:43
  • $\begingroup$ @massy255 Like in my third example, you would need to use LookUp. For example LookUp[eigenAssoc[#], 1, {}]& /@ Blocks (by the way, I highly recommend that you use lowercase or lowerCamelCase for variable names because all Mathematica built-ins are in UpperCamelCase; you would prevent any issues with variable naming). $\endgroup$ – JungHwan Min Jun 25 '18 at 1:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.