Re: preserving order of eigenvalues in a matrix diagonalization
- To: mathgroup at smc.vnet.net
- Subject: [mg61826] Re: [mg61819] preserving order of eigenvalues in a matrix diagonalization
- From: Pratik Desai <pdesai1 at umbc.edu>
- Date: Mon, 31 Oct 2005 06:10:03 -0500 (EST)
- References: <200510310617.BAA28560@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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, > >m = {{2, 0}, {0, 3}} > >some function, say "diagonalize[m]", should just return m. > >If I use > >diagonalize[m_] := Transpose[Eigenvectors[m]].m.Eigenvectors[m] > >it returns {{3, 0}, {0, 2}}. I can certainly write my own routine by >hand, but I thought I'd ask if there's an easy way to ask Mathematica to >preserve the order. > > Unless you sort the eigenvectors to match the sort you want in your eigenvectors, I don't think there is functionality in mathematica which allows to do what you want. You can always use something like diagonalmatrix[m_?MatrixQ] := DiagonalMatrix[Sort[Part[Eigensystem[m], 1]]] which I don't think the solution you are looking for Hope this helps, Pratik . >Thanks, >john > > > -- Pratik Desai Graduate Student UMBC Department of Mechanical Engineering Phone: 410 455 8134
- References:
- preserving order of eigenvalues in a matrix diagonalization
- From: grub_snuffler@yahoo.com
- preserving order of eigenvalues in a matrix diagonalization