MathGroup Archive 2004

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

Search the Archive

Re: A question about sort


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


  • Prev by Date: Re: A question about sort
  • Next by Date: RE: A question about sort
  • Previous by thread: Re: A question about sort
  • Next by thread: RE: A question about sort