2
$\begingroup$

Suppose I have a rank 4 tensor $T_{abcd}$, I can build a SparseArray to input some initial values like $T_{1435}=1$ (a huge amounts of elements are equal to 1) etc. Now I want to antisymmetrize this tensor, then automatically diagonal terms are all 0, and $T_{4135}=T_{1453}=T_{1345}=T_{3415}=T_{5431}=T_{1534}=-1$ and $T_{4153}=1$ etc. How can I achieve this?

PS: I have tried SymmetrizedArray, but it can not do something like {{1,2,3,4},{2,1,4,2}} -> 1.

$\endgroup$
4
$\begingroup$

You're almost there. You just need to add Antisymmetric[{1, 2, 3, 4}]:

sa = SymmetrizedArray[
  {{1, 4, 3, 5} -> 1},
  {5, 5, 5, 5}, 
  Antisymmetric[{1, 2, 3, 4}]
]

Then you can simply visually check with

Normal[sa] // MatrixForm

that by specifying just $T_{1435} = 1$ above, you automatically get $T_{4135}=T_{1453}=T_{1345}=T_{3415}=T_{5431}=T_{1534}=-1$ and $T_{4153}=1$ etc.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you for your answer. One problem I am having with this method is that I have created a huge amount of list contains the position of 1s. But SymmetrizedArray does not allow operation like list->1, and I am not sure how to assign each element in the list to 1 in this case (because there are too many). $\endgroup$ – lol Aug 26 '17 at 3:17
  • $\begingroup$ @lol Suppose your list is list = {{1,2,3,4},{2,1,4,2}}. Use the following as the first argument of SymmetrizedArray: # -> 1 & /@ list. $\endgroup$ – Taiki Aug 26 '17 at 3:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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