Sorting eigenvectors by eigenvalue
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg2054] Sorting eigenvectors by eigenvalue
- From: valentin at wam.umd.edu (William F. Campbell)
- Date: Mon, 18 Sep 1995 01:50:46 -0400
- Organization: University of Maryland, College Park
I'm trying to use Sort to sort eigenvectors by eigenvalue. The eignevectors
are in a list of lists called vecs, and the eigenvalues in vals after the
following function call on matrix aa:
{vals,vecs}=Eigensystem[aa]
Then I want to define an ordering function p so I can use Sort[vecs,p].
I tried the following:
p[vecs[[i_]],vecs[[j_]]]:=Greater[Abs[vals[[i]],Abs[vals[[j]]]]
Mathematica wont parse vecs[[i_]] saying that i is neither an integer nor
a list of integers. How can I accomplish what I want to do?
______________________________________________________________________________
| |
| When endeavoring to explain human behaviour, |
| never discount the possibility of stupidity. |
| |
| Never ascribe to malfeasance |
| that which can be explained as stupidity. |
| |
| Bill Campbell |
`----------------------------------------------------------------------------'