Re: question about sorting lists
- To: mathgroup at smc.vnet.net
- Subject: [mg91027] Re: question about sorting lists
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Mon, 4 Aug 2008 03:22:11 -0400 (EDT)
- References: <g6emrs$cmj$1@smc.vnet.net>
Hi,
lst = {{4, -3,
8}, {{x11, x12, x13}, {x21, x22, x23}, {x31, x32, x33}}};
Transpose[Sort[Transpose[lst], Abs[#1[[1]]] < Abs[#2[[1]]] &]]
Regards
Jens
Tatyana Polenova wrote:
> Hello,
>
> I have the following numerical list:
>
> {{{x1, x2, x3}, {{x11, x12, x13}, {x21, x22, x23}, {x31, x32, x33}}}
>
> where x1, x2, and x3 are some eigenvalues, and {x11, x12, x13}, {x21,
> x22, x23}, and {x31, x32, x33} are their corresponding eigenvectors.
>
> I need to sort the list so that the eigenvalues are arranged in the
> order of decreasing the absolute value of the difference between any
> of the two eigenvalues. (and that the eigenvectors still correspond to
> the original eigenvalues).
>
> What would be the correct syntax for this operation in Mathematica 5.2?
>
> Thank you very much for your help
> Tatyana
>