Unitarize

<< Unitarize`

Spherical Polygon Inequalities

Check the sperical polygon inequalities on various values

PolygonInequalities[1/3, 1/3, 1/3]

PolygonInequalities[1/3, 1/3, 1/2]

PolygonInequalities[{1/8, 1/9, 1/10, 1/11, 1/12}]

An example with tolerance

PolygonInequalities[{1/3, 1/3, 1/3 + 10^-6}, 
      Tolerance -> 10^-6]

Check strict equality

PolygonInequalities[{1/3, 1/3, 1/4}, 
      CheckStrict -> True]
PolygonInequalities[{1/3, 1/3, 1/3}, 
      CheckStrict -> True]
PolygonInequalities[{1/3, 1/3, 1/2}, 
      CheckStrict -> True]

Print a message telling which inequality fails

PolygonInequalities[{1/3, 1/3, 1/2}, Verbose -> True]

Unitarization

Functions to construct arbitrary matrices in SL2(C) and SU2

randomInt[] := 
        Random[Integer, {-10, 10}];
randomCpx[] := 
        randomInt[] + I randomInt[];
randomSL2[] := 
      Block[{P, 
          x}, 
P = {{randomCpx[], 
              randomCpx[]}, {randomCpx[], x}}; 
P = 
          P /. Solve[Det[P] == 1, 
                x][[1]]]
randomSU2[] := 
      Block[{a, b, P}, 
a = randomCpx[]; 
        b = randomCpx[]; 
P = {{a, b}, {-Conjugate[b], 
              Conjugate[a]}}; 
P/
          Sqrt[Det[P]]
]

Construct two simultanously unitarizable matrices M1, M2 by simultaneously conjugating two matrices L1, L2 in SU2 by a matrix P in SL2(C).

P = randomSL2[]
L1 = randomSU2[]
L2 = randomSU2[]

M1 = P . L1 . Inverse[P] // Simplify
M2 = P . L2 . Inverse[P] // Simplify

The unitarizer

T = QRDecomposition[Inverse[P]][[2]] // Simplify

Check whether M1 and M2 are simultaneously unitarizable

Unitarizable[M1, M2]

Compute the upper triangular unitarizer Q

Q = Unitarizer[M1, M2]

Q == T

Verify that Q is a unitarizer

N1 = Q . M1 . Inverse[Q] // Simplify
N2 = Q . M2 . Inverse[Q] // Simplify

SU2[N1]
SU2[N2]

A numerical example with tolerence

Qn = Unitarizer[N[M1], N[M2], Tolerance -> 10^-10]

Chop[Qn - N[Q]] == {{0, 0}, {0, 0}}