MathGroup Archive 2005

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

Search the Archive

Re: preserving order of eigenvalues in a matrix diagonalization


Hello,

On Mon, 31 Oct 2005 grub_snuffler at yahoo.com wrote:

> I'm trying to diagonalize a matrix in Mathematica, but I need the eigenvalues
> to stay in order.  So, for instance, for the initial matrix m,

[snip]

First, how do you specify the order of the eigenvalues, if your matrix is
not diagonal to begin with?

I had the same problem: I un-diagonalized a diagonal matrix with a unitary
matrix in the beginning, used it in the initial conditions to a system of
ODEs, and later had to recover the _changed_ eigenvalues AND eigenvectors
in the same order as put in. (As the eigenvalues were continuous functions
of the variable t, their order made sense.)

I did not find an easy way.

So I:

1) got symbolic expressions for eigenvalues by evaluationg the native
Eigenvalues function for a general matrix of appropriate dimension, e.g.
{{m11,m12},{m21,m22}} in your case);

2) re-ordered the said expressions by evaluating them numerically on the
initial matrix and comparing them to the initial eigenvalues (in correct
order by def.);

3) and made the expressions into a function.

It is not pretty, but it does work.

The eigenvectors I reordered after eigenvalues, of course.

Kristjan Kannike


  • Prev by Date: Re: preserving order of eigenvalues in a matrix diagonalization
  • Next by Date: pattern matching question
  • Previous by thread: Re: preserving order of eigenvalues in a matrix diagonalization
  • Next by thread: Some Mathematica tips & tricks