Re: A question about sort
- To: mathgroup at smc.vnet.net
- Subject: [mg48215] Re: A question about sort
- From: "Borut Levart" <bole79 at email.si>
- Date: Tue, 18 May 2004 04:16:32 -0400 (EDT)
- References: <c89q6d$t65$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
God kväll! result = Eigensystem[ matrix ] gives a list {values, vectors}, where the values are already sorted from greatest to smallest, the vectors accordingly. Changing the default sorting is possible: Sort[ Transpose[result], (#1[[1]] <#2[[1]])& ] will change the order of the values and corresponding vectors to smallest-to-greatest. Transpose it again to obtain the original structure. To sort it differently, come up with your sorting function that compares the values of the neighboring elements. Now that should help! Borut > Europe > Slovenia > Ljubljana "Daohua Song" <ds2081 at columbia.edu> wrote in message news:c89q6d$t65$1 at smc.vnet.net... > Hi everyone, > 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 ? > Thanks > Song >