Re: question about sorting lists
- To: mathgroup at smc.vnet.net
- Subject: [mg90918] Re: question about sorting lists
- From: Ray Koopman <koopman at sfu.ca>
- Date: Tue, 29 Jul 2008 06:10:16 -0400 (EDT)
- References: <g6h5ec$h1f$1@smc.vnet.net>
On Jul 26, 11:43 pm, Tatyana Polenova <tpole... at mail.chem.udel.edu> wrote: > Indeed, I forgot to specify that the eigenvalues have to also > be arranged in order of increasing or decreasing their values > depending on what the distance is between the adjacent two. > Say, the eigenvalues list is {-2, 1, -3}. The way this list > needs to be ordered is {-3, -2, 1}. If the list is {1, 2, -3} > then it needs to be ordered as {2, 1, -3}. So that the middle > element in the list has an intermediate absolute value, and > the distance between the second and the third elements in the > list is the largest. With the typo corrected: Transpose @ If[#[[2,1]]<.5(#[[1,1]]+#[[3,1]]),#,Reverse@#]& @ Sort @ Transpose @ Eigensystem @ yourmatrix