Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
>


  • Prev by Date: Re: Precision of output
  • Next by Date: RE: Maclaurin Series
  • Previous by thread: Re: A question about sort
  • Next by thread: Hypergeometric function reg.,