3 Formatting
source | link

Starting from some sysmetricsymmetric $L\times L$ matrices $M$(see below), I want to compute the eigenvectors in mathematicaMathematica, in order to construct an orthogonal operator $U$ such that

$U^T.M.U=D$

yields a diagonal matrix. Now, I'm not really satisfied with the default ordering.

For constructing the matrices, I first define, with eg. $L=5,n=1;$ the vectors

 dmcos = Array[- Cos[-Pi + 2 Pi (# - 1)/L ] &, L];
 dn = ConstantArray[J, L - n];
  • If the matrix is already diagonal (M0=DiagonalMatrix[dmcos]) the expected and orthogonal matrix of eigenvectors would be the identity-matrix of course(which is what I prefer), but the result of

    U=N@Eigenvectors[M0]//Transpose
    

    is a different one, although it consists only of 0's and 1's as well.

  • If more diagonals have nonzero elements (M1=SparseArray[{Band[{1, 1}] -> dmcos, Band[{1, n + 1}] -> dn, Band[{n + 1, 1}] -> dn)]//Normal), I would like to have the eigenvectors sorted in the same way as M0, to be a bit more precise, if we would vary J continuously from 0 to some finite value, every single column in the matrix U should change continuously as well.

I explicitly want to construct a matrix $U$ for a different number of $J$'s because I want to transform other matrices in the same way as $M_0$ changes to $M_1$ so I need to keep track of the correspondence of the eigenvectors with rows and columns in $M$. Intuitively, the ordering I prefer is what I expected from the beginning when diagonalizing $M_1$ but it turns out not to be true, as according to the documentation eigenvectors are sorted according to the absolute value of the corresponding eigenvalues. I tried a generalized eigenvalue as well, which seemed to do slightly better(but I want to be sure I get the right results, not just think it) and a bunch of inverse transformations and so on, but the more I think about it, the more I seem to confuse myself. Nevertheless, what I want is just a simple thing, you could look at $U$ as a transformationmatrixtransformation matrix that transforms $M0$ to $M1$ and vice versa  (which is the way I want it) so it would seem to me there's a short and easy way to do this?

Starting from some sysmetric $L\times L$ matrices $M$(see below), I want to compute the eigenvectors in mathematica, in order to construct an orthogonal operator $U$ such that

$U^T.M.U=D$

yields a diagonal matrix. Now, I'm not really satisfied with the default ordering.

For constructing the matrices, I first define, with eg. $L=5,n=1;$ the vectors

 dmcos = Array[- Cos[-Pi + 2 Pi (# - 1)/L ] &, L];
 dn = ConstantArray[J, L - n];
  • If the matrix is already diagonal (M0=DiagonalMatrix[dmcos]) the expected and orthogonal matrix of eigenvectors would be the identity-matrix of course(which is what I prefer), but the result of

    U=N@Eigenvectors[M0]//Transpose
    

    is a different one, although it consists only of 0's and 1's as well.

  • If more diagonals have nonzero elements (M1=SparseArray[{Band[{1, 1}] -> dmcos, Band[{1, n + 1}] -> dn, Band[{n + 1, 1}] -> dn)]//Normal), I would like to have the eigenvectors sorted in the same way as M0, to be a bit more precise, if we would vary J continuously from 0 to some finite value, every single column in the matrix U should change continuously as well.

I explicitly want to construct a matrix $U$ for a different number of $J$'s because I want to transform other matrices in the same way as $M_0$ changes to $M_1$ so I need to keep track of the correspondence of the eigenvectors with rows and columns in $M$. Intuitively, the ordering I prefer is what I expected from the beginning when diagonalizing $M_1$ but it turns out not to be true, as according to the documentation eigenvectors are sorted according to the absolute value of the corresponding eigenvalues. I tried a generalized eigenvalue as well, which seemed to do slightly better(but I want to be sure I get the right results, not just think it) and a bunch of inverse transformations and so on, but the more I think about it, the more I seem to confuse myself. Nevertheless, what I want is just a simple thing, you could look at $U$ as a transformationmatrix that transforms $M0$ to $M1$ and vice versa(which is the way I want it) so it would seem to me there's a short and easy way to do this?

Starting from some symmetric $L\times L$ matrices $M$(see below), I want to compute the eigenvectors in Mathematica, in order to construct an orthogonal operator $U$ such that

$U^T.M.U=D$

yields a diagonal matrix. Now, I'm not really satisfied with the default ordering.

For constructing the matrices, I first define, with eg. $L=5,n=1;$ the vectors

 dmcos = Array[- Cos[-Pi + 2 Pi (# - 1)/L ] &, L];
 dn = ConstantArray[J, L - n];
  • If the matrix is already diagonal (M0=DiagonalMatrix[dmcos]) the expected and orthogonal matrix of eigenvectors would be the identity-matrix of course(which is what I prefer), but the result of

    U=N@Eigenvectors[M0]//Transpose
    

    is a different one, although it consists only of 0's and 1's as well.

  • If more diagonals have nonzero elements (M1=SparseArray[{Band[{1, 1}] -> dmcos, Band[{1, n + 1}] -> dn, Band[{n + 1, 1}] -> dn)]//Normal), I would like to have the eigenvectors sorted in the same way as M0, to be a bit more precise, if we would vary J continuously from 0 to some finite value, every single column in the matrix U should change continuously as well.

I explicitly want to construct a matrix $U$ for a different number of $J$'s because I want to transform other matrices in the same way as $M_0$ changes to $M_1$ so I need to keep track of the correspondence of the eigenvectors with rows and columns in $M$. Intuitively, the ordering I prefer is what I expected from the beginning when diagonalizing $M_1$ but it turns out not to be true, as according to the documentation eigenvectors are sorted according to the absolute value of the corresponding eigenvalues. I tried a generalized eigenvalue as well, which seemed to do slightly better(but I want to be sure I get the right results, not just think it) and a bunch of inverse transformations and so on, but the more I think about it, the more I seem to confuse myself. Nevertheless, what I want is just a simple thing, you could look at $U$ as a transformation matrix that transforms $M0$ to $M1$ and vice versa  (which is the way I want it) so it would seem to me there's a short and easy way to do this?

2 Formatting
source | link

Starting from some symmetricsysmetric $L\times L$ matrices $M$(see below), I want to compute the eigenvectorseigenvectors in mathematica, in order to construct an orthogonal operatororthogonal operator $U$ such that $U^T.M.U=D$

$U^T.M.U=D$

yields a diagonal matrix. Now, I'm not really satisfied with the default ordering. 

For constructing the matrices, I first define, with eg. $L=5,n=1;$ the vectors

 dmcos = Array[- Cos[-Pi + 2 Pi (# - 1)/L ] &, L];
 dn = ConstantArray[J, L - n];
  1. If the matrix is already diagonal (M0=DiagonalMatrix[dmcos]) the expected and orthogonal matrix of eigenvectors would be the identity-matrix of course(which is what I prefer), but the result of

    U=N@Eigenvectors[M0]//Transpose
    

    is a different one, although it consists only of 0's and 1's as well.

  2. If more diagonals have nonzero elements (M1=SparseArray[{Band[{1, 1}] -> dmcos, Band[{1, n + 1}] -> dn, Band[{n + 1, 1}] -> dn)]//Normal), I would like to have the eigenvectors sorted in the same way as M0, to be a bit more precise, if we would vary J continuously from 0 to some finite value, every single column in the matrix U should change continuously as well.

  • If the matrix is already diagonal (M0=DiagonalMatrix[dmcos]) the expected and orthogonal matrix of eigenvectors would be the identity-matrix of course(which is what I prefer), but the result of

    U=N@Eigenvectors[M0]//Transpose
    

    is a different one, although it consists only of 0's and 1's as well.

  • If more diagonals have nonzero elements (M1=SparseArray[{Band[{1, 1}] -> dmcos, Band[{1, n + 1}] -> dn, Band[{n + 1, 1}] -> dn)]//Normal), I would like to have the eigenvectors sorted in the same way as M0, to be a bit more precise, if we would vary J continuously from 0 to some finite value, every single column in the matrix U should change continuously as well.

I explicitly want to construct a matrix $U$ for a different number of $J$'s because I want to transform other matrices in the same way as $M_0$ changes to $M_1$ so I need to keep track of the correspondence of the eigenvectors with rows and columns in $M$. Intuitively, the ordering I prefer is what I expected from the beginning when diagonalizing $M_1$ but it turns out not to be true, as according to the documentation eigenvectors are sorted according to the absolute value of the corresponding eigenvalues. I tried a generalized eigenvalue as well, which seemed to do slightly better(but I want to be sure I get the right results, not just think it) and a bunch of inverse transformations and so on, but the more I think about it, the more I seem to confuse myself. Nevertheless, what I want is just a simple thing, you could look at $U$ as a transformationmatrix that transforms $M0$ to $M1$ and vice versa(which is the way I want it) so it would seem to me there's a short and easy way to do this?

Starting from some symmetric $L\times L$ matrices $M$(see below), I want to compute the eigenvectors in mathematica, in order to construct an orthogonal operator $U$ such that $U^T.M.U=D$ yields a diagonal matrix. Now, I'm not really satisfied with the default ordering. For constructing the matrices, I first define, with eg. $L=5,n=1;$ the vectors

 dmcos = Array[- Cos[-Pi + 2 Pi (# - 1)/L ] &, L];
 dn = ConstantArray[J, L - n];
  1. If the matrix is already diagonal (M0=DiagonalMatrix[dmcos]) the expected and orthogonal matrix of eigenvectors would be the identity-matrix of course(which is what I prefer), but the result of

    U=N@Eigenvectors[M0]//Transpose
    

    is a different one, although it consists only of 0's and 1's as well.

  2. If more diagonals have nonzero elements (M1=SparseArray[{Band[{1, 1}] -> dmcos, Band[{1, n + 1}] -> dn, Band[{n + 1, 1}] -> dn)]//Normal), I would like to have the eigenvectors sorted in the same way as M0, to be a bit more precise, if we would vary J continuously from 0 to some finite value, every single column in the matrix U should change continuously as well.

I explicitly want to construct a matrix $U$ for a different number of $J$'s because I want to transform other matrices in the same way as $M_0$ changes to $M_1$ so I need to keep track of the correspondence of the eigenvectors with rows and columns in $M$. Intuitively, the ordering I prefer is what I expected from the beginning when diagonalizing $M_1$ but it turns out not to be true, as according to the documentation eigenvectors are sorted according to the absolute value of the corresponding eigenvalues. I tried a generalized eigenvalue as well, which seemed to do slightly better(but I want to be sure I get the right results, not just think it) and a bunch of inverse transformations and so on, but the more I think about it, the more I seem to confuse myself. Nevertheless, what I want is just a simple thing, you could look at $U$ as a transformationmatrix that transforms $M0$ to $M1$ and vice versa(which is the way I want it) so it would seem to me there's a short and easy way to do this?

Starting from some sysmetric $L\times L$ matrices $M$(see below), I want to compute the eigenvectors in mathematica, in order to construct an orthogonal operator $U$ such that

$U^T.M.U=D$

yields a diagonal matrix. Now, I'm not really satisfied with the default ordering. 

For constructing the matrices, I first define, with eg. $L=5,n=1;$ the vectors

 dmcos = Array[- Cos[-Pi + 2 Pi (# - 1)/L ] &, L];
 dn = ConstantArray[J, L - n];
  • If the matrix is already diagonal (M0=DiagonalMatrix[dmcos]) the expected and orthogonal matrix of eigenvectors would be the identity-matrix of course(which is what I prefer), but the result of

    U=N@Eigenvectors[M0]//Transpose
    

    is a different one, although it consists only of 0's and 1's as well.

  • If more diagonals have nonzero elements (M1=SparseArray[{Band[{1, 1}] -> dmcos, Band[{1, n + 1}] -> dn, Band[{n + 1, 1}] -> dn)]//Normal), I would like to have the eigenvectors sorted in the same way as M0, to be a bit more precise, if we would vary J continuously from 0 to some finite value, every single column in the matrix U should change continuously as well.

I explicitly want to construct a matrix $U$ for a different number of $J$'s because I want to transform other matrices in the same way as $M_0$ changes to $M_1$ so I need to keep track of the correspondence of the eigenvectors with rows and columns in $M$. Intuitively, the ordering I prefer is what I expected from the beginning when diagonalizing $M_1$ but it turns out not to be true, as according to the documentation eigenvectors are sorted according to the absolute value of the corresponding eigenvalues. I tried a generalized eigenvalue as well, which seemed to do slightly better(but I want to be sure I get the right results, not just think it) and a bunch of inverse transformations and so on, but the more I think about it, the more I seem to confuse myself. Nevertheless, what I want is just a simple thing, you could look at $U$ as a transformationmatrix that transforms $M0$ to $M1$ and vice versa(which is the way I want it) so it would seem to me there's a short and easy way to do this?

1
source | link

Eigenvectors choose intuitive ordering/sorting

Starting from some symmetric $L\times L$ matrices $M$(see below), I want to compute the eigenvectors in mathematica, in order to construct an orthogonal operator $U$ such that $U^T.M.U=D$ yields a diagonal matrix. Now, I'm not really satisfied with the default ordering. For constructing the matrices, I first define, with eg. $L=5,n=1;$ the vectors

 dmcos = Array[- Cos[-Pi + 2 Pi (# - 1)/L ] &, L];
 dn = ConstantArray[J, L - n];
  1. If the matrix is already diagonal (M0=DiagonalMatrix[dmcos]) the expected and orthogonal matrix of eigenvectors would be the identity-matrix of course(which is what I prefer), but the result of

    U=N@Eigenvectors[M0]//Transpose
    

    is a different one, although it consists only of 0's and 1's as well.

  2. If more diagonals have nonzero elements (M1=SparseArray[{Band[{1, 1}] -> dmcos, Band[{1, n + 1}] -> dn, Band[{n + 1, 1}] -> dn)]//Normal), I would like to have the eigenvectors sorted in the same way as M0, to be a bit more precise, if we would vary J continuously from 0 to some finite value, every single column in the matrix U should change continuously as well.

I explicitly want to construct a matrix $U$ for a different number of $J$'s because I want to transform other matrices in the same way as $M_0$ changes to $M_1$ so I need to keep track of the correspondence of the eigenvectors with rows and columns in $M$. Intuitively, the ordering I prefer is what I expected from the beginning when diagonalizing $M_1$ but it turns out not to be true, as according to the documentation eigenvectors are sorted according to the absolute value of the corresponding eigenvalues. I tried a generalized eigenvalue as well, which seemed to do slightly better(but I want to be sure I get the right results, not just think it) and a bunch of inverse transformations and so on, but the more I think about it, the more I seem to confuse myself. Nevertheless, what I want is just a simple thing, you could look at $U$ as a transformationmatrix that transforms $M0$ to $M1$ and vice versa(which is the way I want it) so it would seem to me there's a short and easy way to do this?