TransWikia.com

Sorting the eigensystem of a symbolic matrix

Mathematica Asked by Shasa on February 21, 2021

My symbolic matrix $A$ reads

begin{equation*}
left(
begin{array}{ccc}
a left(x^2+y^2+z^2right) & b y z+i v x & -i v y \
b y z-i v x & a left(x^2+y^2+z^2right) & b x y+i v z \
i v y & b x y-i v z & a left(x^2+y^2+z^2right) \
end{array}
right),
end{equation*}

where $a,b,v$ are nonnegative real numbers, and $x,y,z$ denote Cartesian coordinates.

$Assumptions = Element[{a, v, b}, Reals] && v >= 0 && b >= 0 && a >= 0;

A = ConstantArray[0, {3, 3}];
diagm = {a (x^2 + y^2 + z^2), a (x^2 + y^2 + z^2), 
  a (x^2 + y^2 + z^2)}; nondiagm = {I v x + b z y  , -I v y , 
  b x y + I v z};
A[[1, 1]] = diagm[[1]];
A[[2, 2]] = diagm[[2]];
A[[3, 3]] = diagm[[3]];
A[[1, 2]] = nondiagm[[1]];
A[[2, 1]] = Conjugate[A[[1, 2]]];
A[[1, 3]] = nondiagm[[2]];
A[[3, 1]] = Conjugate[A[[1, 3]]];
A[[2, 3]] = nondiagm[[3]];
A[[3, 2]] = Conjugate[A[[2, 3]]];
Af = ComplexExpand /@ A // Simplify;
Af // MatrixForm
evals = Eigenvalues[Af, Cubics -> True];

Using Eigensystem, I can calculate the eigenvalues and eigenvectors of my matrix. For a specific $a,b,v,x,y,z$, I notice that the eigenvalues are not sorted. I can try to sort this particular matrix using this and this threads

Aftmp = Af /. {z -> 2, x -> 2, y -> 2, v -> 1, b -> 0.5, a -> 0.2} // Simplify;
Transpose@SortBy[Transpose[Eigensystem[Aftmp]], N]

Now, my question is how can I apply this particular order of numerical eigensystems to my symbolic matrix? As I need to use an ordered eigensystem in the rest of my script for various matrices, a non-hardcoded approach is much appreciated.

One Answer

If I understand you correctly you believe that the eigenvalues will be sorted the same for any choice of parameters. This sounds highly dubious to me, but who knows.

I am not sure what you mean by "not hardcoded" as you specify that you want "this particular order". So I might have misunderstood you completely.

You can get the ordering of a list by the aptly named Ordering. For instance,

orig = {1, 5, 4};
Part[orig, Ordering[orig]]
(*{1,4,5}*)

For an Eigensystem you need to Map the ordering over both the eigenvalues and eigenvectors. One solution is (with your choice of parameters as the representative)

orderedEigensystem = 
  Module[{ord = 
     Ordering@
      Eigenvalues[
       Af /. {z -> 2, x -> 2, y -> 2, v -> 1, b -> 0.5, a -> 0.2}]},
   Map[Part[#, ord] &, Eigensystem[#]] &];
orderedEigensystem[Af]

which gives you the symbolic eigensystem which is ordered as the particular order you proposed.

Correct answer by Natas on February 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP