Re: Re: preserving order of eigenvalues in a matrix diagonalization
- To: mathgroup at smc.vnet.net
- Subject: [mg61849] Re: [mg61824] Re: [mg61819] preserving order of eigenvalues in a matrix diagonalization
- From: Pratik Desai <pdesai1 at umbc.edu>
- Date: Tue, 1 Nov 2005 00:39:57 -0500 (EST)
- References: <200510310617.BAA28560@smc.vnet.net> <200510311110.GAA03211@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Kristjan Kannike wrote: >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? > > You don't, but since the eigenvalues are an ordered set of values, they can always be sorted. The fun actually begins when you have match the eigenvectors in the unitary matrix to match the eigenvalues. plus if you have complex eigenvalues, it becomes even more hilarious. :-) >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 > > > -- Pratik Desai Graduate Student UMBC Department of Mechanical Engineering Phone: 410 455 8134