Sorting the eigensystem of a symbolic matrix

My symbolic matrix $$A$$ reads

$$\begin{equation*} \left( \begin{array}{ccc} a \left(x^2+y^2+z^2\right) & b y z+i v x & -i v y \\ b y z-i v x & a \left(x^2+y^2+z^2\right) & b x y+i v z \\ i v y & b x y-i v z & a \left(x^2+y^2+z^2\right) \\ \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. • If you assign $Assumptions twice, the second assignment overwrites the first one. It's a regular variable. – Roman Oct 1 '20 at 12:27
• thanks. Will correct that. – Shasa Oct 1 '20 at 12:37

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.

• Thank you. Your suggestion is helpful. You are right, for every value of parameters, the ordering is not the same but for a range of parameters that I am interested in, the particular suggested numerical values depict the correct ordering of eigenvalues. – Shasa Oct 1 '20 at 12:48