1
$\begingroup$

I'm trying to verify a calculation in Mathematica and I'm confused about how Mathematica arranges tensor "slots" for contractions.

I have the matrix $$J_1 = \begin{pmatrix} 0 & -ih & 0 \\ ih & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}$$

and I'm defining a tensor

$$(J_2)^{ab}_{ij} = (J_1)^a_i \otimes I^b_j + (J_1)^b_j \otimes I^a_i$$

where $I$ is the identity matrix.

I've defined a tensor $J^{(2)}$ with Mathematica as such

J1 = {{0, -I*h, 0}, {I*h, 0, 0}, {0, 0, 0}};  
Id = IdentityMatrix[3];   
J2 = TensorProduct[J1, Id] +TensorProduct[Id, J1]

where I is $i$.

Now I'm trying to contract $(J_2)^{ab}_{ij}$ with

$$ \epsilon^{ij} = \frac{1}{2} \begin{pmatrix} 1 & i & 0 \\ i & -1 & 0 \\ 0 & 0 & 0 \end{pmatrix}$$

to get $$(J_2)^{ab}_{ij}\epsilon^{ij}.$$ I know this $\epsilon$ matrix is an "eigenmatrix" of our tensor, and that it should contract to a multiple of itself

So I tried writing

> \[CurlyEpsilon]A = (1/2)*{{1, I, 0}, {I, -1, 0}, {0, 0, 0}};
> TensorContract[TensorProduct[J2, \[CurlyEpsilon]A], {{2, 5}, {3, 6}}]

thinking that maybe I have constructed the tensor with indices

$J^{ab}_{ij}\epsilon^{kl}$ and that the indexes were numbered $(a,i,b,j,k,l) = (1,2,3,4,5,6)$ so that contracting slots (2,5) and (3,6) would do the trick, though I was really unsure. This gave the wrong answer of 0s, and after some testing I found that contracting "slots" (1,5) and (3,6) gave the desired result.

How do I know what I'm contracting exactly in this case? What do the "slots" in Mathematica's tensor contraction function even mean? How can I keep track of indexes while doing calculations like this, especially since I'm defining things using tensor products and such.

Any advice would be appreciated.

UPDATE:

I realize now I made an error. $(a,i,b,j,k,l) = (1,2,3,4,5,6)$ was right - I was just to contract 2 and 5 and 4 and 6.

$\endgroup$

1 Answer 1

3
$\begingroup$

MMA only knows about lists, no contra or cogradient indices. Therefore, the indices are written linearly. E.g, TensorProduct[ai1,i2 ,bi1,i2]

(tp = TensorProduct[Array[Subscript[a, #1, #2] &, {2, 2}], 
   Array[Subscript[b, #1, #2] &, {2, 2}]]) // MatrixForm

enter image description here

Therefore the element a1,2 b2,1 has the indices 1,2,2,1: tp[[1, 2, 2, 1]]. The first 2 indices belong to a and the second 2 indices belong to b.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.