fkampas
(Frank Kampas)
April 17, 2015, 1:24pm
1
For an online quantum mechanics course, I had to construct a matrix representation of the tensor product of two Pauli Spin Matrices.
I did it as follows:
In[1]:= p1 = PauliMatrix[1]; p2 = PauliMatrix[2];
In[2]:= Join[Join[p1[[1, 1]]*p2, p1[[1, 2]]*p2, 2],
Join[p1[[2, 1]]*p2, p1[[2, 2]]*p2, 2]]
Out[2]= {{0, 0, 0, -I}, {0, 0, I, 0}, {0, -I, 0, 0}, {I, 0, 0, 0}}
I got the right answer but don’t like the method I used, as it would be difficult to generalize to large matrices. Any suggestions?
seanc
(Sean Clarke)
April 17, 2015, 3:01pm
2
This operation is called the kronecker product when applied to matrices. There is a function for it:
KroneckerProduct[p1, p2]
Usually when you see this, you’re actually doing a tensor product.
ArrayFlatten@TensorProduct[p1, p2]
{{0, 0, 0, -I}, {0, 0, I, 0}, {0, -I, 0, 0}, {I, 0, 0, 0}}
But, if I hadn’t known any of this before, here is how I might have written it:
ArrayFlatten[placeholder*p2 /. placeholder -> p1]
fkampas
(Frank Kampas)
April 17, 2015, 5:08pm
3
Thanks. I’ve been using Mathematica since Version 2.2 but still only know part of its functionality.