import numpy as np
z_plus_bra = np.array([[1,0]])
z_minus_bra = np.array([[0,1]])
z_plus_ket = z_plus_bra.T
z_minus_ket = z_minus_bra.T
x_plus_bra = 1/np.sqrt(2)*np.array([[1,1]])
x_minus_bra = 1/np.sqrt(2)*np.array([[1,-1]])
x_plus_ket = x_plus_bra.T
x_minus_ket = x_minus_bra.T
y_plus_bra = 1/np.sqrt(2)*np.array([[1, -1j]])
y_minus_bra = 1/np.sqrt(2)*np.array([[1, 1j]])
y_plus_ket = np.conj(y_plus_bra.T)
y_minus_ket = np.conj(y_minus_bra.T)
Jz_z = np.array([[1,0],[0,-1]]) #Jz operator in z-basis
print("R(" + "theta" + " * k)" + " in the Sz basis can be represented as:")
Rotation_theta = np.array([[np.exp(-1j*np.pi/2),0],[0,np.exp(1j*np.pi/2)]])
print(Rotation_theta)
Rotation_theta_transverse = np.conj(Rotation_theta.T)
print("taking the tranverse(complex conjugate, we obtain")
print(Rotation_theta_transverse)
print()
print("Applying this to find if R is unitary,")
Unitary = z_plus_bra@Rotation_theta_transverse@Rotation_theta@z_plus_ket
print(Unitary)
R(theta * k) in the Sz basis can be represented as:
[[6.123234e-17-1.j 0.000000e+00+0.j]
[0.000000e+00+0.j 6.123234e-17+1.j]]
taking the tranverse(complex conjugate, we obtain
[[6.123234e-17+1.j 0.000000e+00-0.j]
[0.000000e+00-0.j 6.123234e-17-1.j]]
Applying this to find if R is unitary,
[[1.+0.j]]
x_plus_ket_Sy = np.array([[y_plus_bra@x_plus_ket],[y_minus_bra@x_plus_ket]])
print(x_plus_ket_Sy)
x_minus_ket_Sy = np.array([[y_plus_bra@x_minus_ket],[y_plus_bra@x_minus_ket]])
print(x_minus_ket_Sy)
[[[[0.5-0.5j]]]
[[[0.5+0.5j]]]]
[[[[0.5+0.5j]]]
[[[0.5+0.5j]]]]
print("We want to find the representation of jz in the sy basis. unlike our value of S before, we are converting from Sz basis to Sy, not Sx")
#Sy = np.array([[(z_plus_bra@y_plus_ket), (z_plus_bra@y_minus_ket)],[(z_minus_bra@y_plus_ket),(z_minus_bra@y_minus_ket)]])
Sy = np.array([[1/np.sqrt(2), 1/np.sqrt(2)],[1j/np.sqrt(2),-1j/np.sqrt(2)]])
print(Sy)
Jz_y = np.conj(Sy.T)@Jz_z@Sy
print(Jz_y)
We want to find the representation of jz in the sy basis. unlike our value of S before, we are converting from Sz basis to Sy, not Sx
[[ 0.70710678+0.j 0.70710678+0.j ]
[ 0. +0.70710678j -0. -0.70710678j]]
[[-2.23711432e-17+0.j 1.00000000e+00+0.j]
[ 1.00000000e+00+0.j -2.23711432e-17+0.j]]