# Equivalence between tensor and matrix

I need have to create a real antisymmetric tensor whose elements are given as $$p_{abcd}$$ $${\displaystyle p_{abcd}={\begin{cases} +p_{\sigma\left(abcd\right)} & {\text{if }}\sigma(a,b,c,d){\text{ is an even permutation }}\\ -p_{\sigma\left(abcd\right)} & {\text{if }}\sigma(a,b,c,d){\text{ is an odd permutation }}\\ \;\;\,0 & {\text{otherwise}.} \end{cases}}}$$

For example if I need to create a random real antisymmetric tensor of order 4, then:first step, $$p_{cd}=\begin{bmatrix}p_{11,cd} & p_{12,cd} & p_{13,cd} & p_{14,cd}\\ p_{21,cd} & p_{22,cd} & p_{23,cd} & p_{24,cd}\\ p_{31,cd} & p_{32,cd} & p_{33,cd} & p_{34,cd}\\ p_{41,cd} & p_{42,cd} & p_{43,cd} & p_{44,cd} \end{bmatrix}$$

Then $$p=\begin{bmatrix}\begin{pmatrix}p_{11,11} & p_{12,11} & p_{13,11} & p_{14,11}\\ p_{21,11} & p_{22,11} & p_{23,11} & p_{24,11}\\ p_{31,11} & p_{32,11} & p_{33,11} & p_{34,11}\\ p_{41,11} & p_{42,11} & p_{43,11} & p_{44,11} \end{pmatrix} & \begin{pmatrix}p_{11,12} & p_{12,12} & p_{13,12} & p_{14,12}\\ p_{21,12} & p_{22,12} & p_{23,12} & p_{24,12}\\ p_{31,12} & p_{32,12} & p_{33,12} & p_{34,12}\\ p_{41,12} & p_{42,12} & p_{43,12} & p_{44,12} \end{pmatrix} & \begin{pmatrix}p_{11,13} & p_{12,13} & p_{13,13} & p_{14,13}\\ p_{21,13} & p_{22,13} & p_{23,13} & p_{24,13}\\ p_{31,13} & p_{32,13} & p_{33,13} & p_{34,13}\\ p_{41,13} & p_{42,13} & p_{43,13} & p_{44,13} \end{pmatrix} & \begin{pmatrix}p_{11,14} & p_{12,14} & p_{13,14} & p_{14,14}\\ p_{21,14} & p_{22,14} & p_{23,14} & p_{24,14}\\ p_{31,14} & p_{32,14} & p_{33,14} & p_{34,14}\\ p_{41,14} & p_{42,14} & p_{43,14} & p_{44,14} \end{pmatrix}\\ . & . & . & .\\ . & . & . & .\\ \begin{pmatrix}p_{11,41} & p_{12,41} & p_{13,41} & p_{14,41}\\ p_{21,41} & p_{22,41} & p_{23,41} & p_{24,41}\\ p_{31,41} & p_{32,41} & p_{33,41} & p_{34,41}\\ p_{41,41} & p_{42,41} & p_{43,41} & p_{44,41} \end{pmatrix} & . & . & \begin{pmatrix}p_{11,44} & p_{12,44} & p_{13,44} & p_{14,44}\\ p_{21,44} & p_{22,44} & p_{23,44} & p_{24,44}\\ p_{31,44} & p_{32,44} & p_{33,44} & p_{34,44}\\ p_{41,44} & p_{42,44} & p_{43,44} & p_{44,44} \end{pmatrix} \end{bmatrix}$$

But we can consider the above tensor as a 16 X 16 matrix also. But in that case we will index as: $$p=\begin{bmatrix}p_{11} & p_{12} & p_{13} & . & . & . & & & & & & & & & & p_{1,16}\\ p_{21}\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ p_{16,1} & & & & & & & & & & & & & & & p_{16,16} \end{bmatrix}$$ If I define p in Mathematica as:

Clear[p]
p[arg__] /; ! OrderedQ@{arg} := Signature@{arg} p @@ Sort@{arg}
p[___, j_, j_, ___] = 0;
Format[p[arg__]] := Subscript[p, arg]


and created a 16 X 16 matrix in Mathematica as:

pmat = Table[
If[i > j, RandomReal[], -RandomReal[]], {i, 16}, {j, 16}];


How can I map elements from tensor to pmat? For example what is p[1,1,3,4] in pmat?

• Is this Transpose[Array[Subscript[p, ##] &, {4, 4, 4, 4}], 2 <-> 4] // MatrixForm what you want? BTW, your tensor p might be LeviCivitaTensor[4]. Aug 3, 2021 at 7:11

ArrayFlatten[LeviCivitaTensor[4]] // Normal

$$\left( \begin{array}{cccccccccccccccc} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 1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