Problem 3. Let M be a 2 x 2 matrix and
Solution 3. Let us first look at the tensor product
xxxxxxxxxx1
1
using SymPyxxxxxxxxxx6
1
begin2
#⊗(x,y) = sympy.tensorproduct(x,y) # Doesn't seem to work properly.3
⊗(x::Array{Sym,2},y::Array{Sym,2}) = kron(x,y)4
𝐓(x::Array{Sym,2}) = sympy.Matrix(sympy.transpose(x))5
⋅ = *6
end;xxxxxxxxxx6
1
begin2
M₁,M₂,M₃,M₄ = sympy.symbols("M₁₁ M₁₂ M₂₁ M₂₂")3
M= sympy.Matrix([M₁ M₂;4
M₃ M₄])5
I₂ = sympy.eye(2,2)6
end;xxxxxxxxxx1
1
𝓞₁ = M ⊗ I₂xxxxxxxxxx1
1
𝓞₂ = I₂ ⊗ Mxxxxxxxxxx6
1
begin2
ψ₀ = sympy.Matrix([1;3
0])4
ψ₁ = sympy.Matrix([0;5
1])6
end;xxxxxxxxxx1
1
expr1 = 𝓞₁ ⋅ ((ψ₀⊗ψ₀) + (ψ₁⊗ψ₁));xxxxxxxxxx1
1
expr2 = 𝓞₂ ⋅ ((ψ₀⊗ψ₀) + (ψ₁⊗ψ₁));Lets see if these two expressions are equivalent with
In fact they are not. Now lets see if
xxxxxxxxxx4
1
begin2
𝓞₃ = (I₂ ⊗ 𝐓(M))3
expr3 = 𝓞₃ ⋅ ((ψ₀⊗ψ₀) + (ψ₁⊗ψ₁));4
end;truexxxxxxxxxx1
1
expr1 == expr3Indeed the are equal:
What happens for the orthonormal basis:
xxxxxxxxxx7
1
begin2
θ = sympy.symbols("θ",real=true)3
ψₐ = sympy.Matrix([cos(θ);4
sin(θ)])5
ψᵦ = sympy.Matrix([sin(θ);6
-cos(θ)])7
end;xxxxxxxxxx1
1
expr4 = 𝓞₁ ⋅ (( ψₐ ⊗ ψₐ) + (ψᵦ ⊗ ψᵦ))xxxxxxxxxx1
1
expr5 = 𝓞₃ ⋅ (( ψₐ ⊗ ψₐ) + (ψᵦ ⊗ ψᵦ))Indeed they are the same:
truexxxxxxxxxx1
1
sympy.trigsimp(expr4) == sympy.trigsimp(expr5)