Re: A question about sort
- To: mathgroup at smc.vnet.net
- Subject: [mg48214] Re: A question about sort
- From: Marcus Stollsteimer <marcus314 at yahoo.com>
- Date: Tue, 18 May 2004 04:16:29 -0400 (EDT)
- References: <c89q6d$t65$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Daohua Song wrote: > When i get the eigenvalues and eigenvectors for a matrix. i want > to sort the eigenvalues and hope eigenvectors change the positions > correspondingly. How to do it ? Hi, you can use Ordering[], e.g. v1={1,3,2}; v2={a,c,b}; myorder=Ordering[v1]; v1sorted=v1[[myorder]]; v2sorted=v2[[myorder]] Out: {a, b, c} for your specific problem, use {v1,v2} = Eigensystem[matrix] Regards, Marcus -- The truth is rarely pure and never simple. -- Oscar Wilde