Skip to content

Instantly share code, notes, and snippets.

@arvsrao
Last active July 28, 2023 04:52
Show Gist options
  • Save arvsrao/b3423f8404d9e59e7819dae5b6c601fa to your computer and use it in GitHub Desktop.
Save arvsrao/b3423f8404d9e59e7819dae5b6c601fa to your computer and use it in GitHub Desktop.
verify SU(2) maps to SO(3)
from sympy import *
a = Symbol('a', real=true)
b = Symbol('b', real=true)
c = Symbol('c', real=true)
d = Symbol('d', real=true)
x = a + I*b
z = c + I*d
# basis of su(2) lie algebra; a real vector space
e1 = Matrix([[I,0],[0,-I]])
e2 = Matrix([[0,-1],[1,0]])
e3 = Matrix([[0,I],[I,0]])
# generic SU(2) matrix
g = Matrix([[x, -z.conjugate()],[z, x.conjugate()]])
# adjoint map from su(2) into su(2)
ad = lambda X : factor(simplify(expand(g * X * g.H)))
# represent su(2) matrix as a vector in the basis e1, e2, e3
su2Coeff = lambda A : [im(A[0,0]), re(A[1,0]), im(A[1,0])]
# adjoint representation as a matrix
B = Matrix([SU2Coeff(ad(e1)), SU2Coeff(ad(e2)), SU2Coeff(ad(e3))]).transpose()
# check that B \in SO(3)
# 1. det == 1
# 2. B * B^T = Identity Matrix
f = a**2 + b**2 + c**2 + d**2
assert factor(B.det()).subs(f, 1) == 1, "Not special!! Determinent != 1"
assert factor(simplify(B * B.transpose())).subs(f,1) == eye(3) , "Not Orthogonal!!"
# Let v = (a,b,c,d). B(v) = B(-v).
# antipodal points in S^3 are mapped to the same matricies in
# SO(3).
assert B.subs(a,-a).subs(b,-b).subs(c,-c).subs(d,-d) == B, "Uh Oh! Not an Even Function!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment