       Re: preserving order of eigenvalues in a matrix diagonalization

• To: mathgroup at smc.vnet.net
• Subject: [mg61824] Re: [mg61819] preserving order of eigenvalues in a matrix diagonalization
• From: Kristjan Kannike <kkannike at physic.ut.ee>
• Date: Mon, 31 Oct 2005 06:10:02 -0500 (EST)
• References: <200510310617.BAA28560@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```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