I am trying to understand equivariance in machine learning, specially as discussed in the following paper. Claim is that equivariance is when Group symmetry operation, such as rotation, commutes with the hamiltonian (or any other operation of interest for that matter).
In the above paper and extensive literature online claims that Wigner D matrices have the property that their product with Spherical harmoic representation of a position vector is equivalent to rotating the position vector first, and then taking its Spherical harmonic representation. (Sec 4.1.1 in above paper, equation reproduced below)
$$ Y^{(l)}_m (R(g)\hat{r}) = \sum_{m′} D^{(l)}_{mm′}(g) Y^{(l)}_{m′} (\hat{r}) $$ How even in my python example below, I am unable to demonstrate that, what am I not understanding?
import numpy as np
from scipy.special import sph_harm
import spherical
import quaternionic
def cart2sph(x, y, z):
r = np.sqrt(x**2 + y**2 + z**2)
theta = np.arctan2(y,x)
theta = theta if theta < 0 else theta + 2*np.pi
phi = np.arccos(z/r)
return r, theta, phi
x=np.random.rand(3)
r,theta,phi = cart2sph(*x)
# Y = 2
Y2 = [
sph_harm(-2,2,theta,phi),
sph_harm(-1,2,theta,phi),
sph_harm( 0,2,theta,phi),
sph_harm( 1,2,theta,phi),
sph_harm( 2,2,theta,phi)
]
Y2 = np.array(Y2)
# Additional rotation
rot_theta = 0.2; rot_phi = 0.43
Y2_rotated = [
sph_harm(-2,2,theta + rot_theta,phi + rot_phi),
sph_harm(-1,2,theta + rot_theta,phi + rot_phi),
sph_harm( 0,2,theta + rot_theta,phi + rot_phi),
sph_harm( 1,2,theta + rot_theta,phi + rot_phi),
sph_harm( 2,2,theta + rot_theta,phi + rot_phi)
]
Y2_rotated = np.array(Y2_rotated)
# Wigner D matrix
R = quaternionic.array.from_spherical_coordinates(rot_theta, rot_phi)
wigner = spherical.Wigner(2)
D_ = wigner.D(R)
D = D_[-25:].reshape(-5,5)
print(Y2_rotated - D @ Y2)
Ideally above code shall give answer 0.