Message Boards Message Boards

0
|
3759 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Change the order of the eigenvalues and eigenvectors?

Posted 5 years ago

I have two matrices A and B. They have the same eigenvectors, but different eigenvalues. I would like that after a reordering the eigenvalues of the two matrices correspond to the same order of eigenvectors. For convenience, I attached a .nb file, where I explain better what I need. Thanks in advance for any help!

Attachments:
POSTED BY: Martina Reis
2 Replies
Posted 5 years ago

Many thanks! It works!

POSTED BY: Martina Reis

You can store the positions of the unit vectors in the eigensystems in a list, and then reorder eigenvalues and eigenvectors according to the position list:

posTableA = 
 Flatten@Table[Position[vecsA, N@UnitVector[8, i]], {i, 8}]
valsA[[posTableA]] == newvalsA
vecsA[[posTableA]] == newvecsA
posTableB = Flatten@Table[Position[vecsB, UnitVector[8, i]], {i, 8}]
valsB[[posTableB]] == newvalsB
vecsB[[posTableB]] == newvecsB
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract