This question already has an answer here:

Is there any easy way to explicitly contract indices of several given tensors.

For example,

F = {F11, F12, F13, F14, F15};

psi = {{0, f1011, f1021, f1031, f1041},{0, 0, f1051, f1061, f10171},
    {0, 0, 0, f1081, f1091},{0, 0, 0, 0, f10101},{0, 0, 0, 0, 0}}

and I want to evaluate $F_{x}\psi_{ab}\psi_{cd} \epsilon^{xabcd}$, where $\epsilon$ is the LeviCivita symbol or similar equations, as $\psi_{ba}\psi_{bd} F_{d}$. Is there any package or inbuild function that enables to enter such computations in a non-confusing manner? So far, I tried to work with workarounds like this and using Inner, which becomes quite confusing as soon as there are several tensors involved. All packages I was able to find are built specifically for computations in general relativity and thus not really straight-forward to use for such computations.


marked as duplicate by Artes, m_goldberg, user9660, MarcoB, Jens Dec 28 '15 at 4:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


A simple, although inelegant, approach to evaluating the expression in the question or similar expressions is

Sum[F[[x]] psi[[a, b]] psi[[c, d]] LeviCivitaTensor[5][[x, a, b, c, d]], 
    {x, 5}, {a, 5}, {b, 5}, {c, 5}, {d, 5}] // Simplify
(* 2 (-f1061 f1091 F11 - f1041 f1081 F12 + f1031 f1091 F12 + 
      f1041 f1061 F13 + f10101 (f1051 F11 - f1021 F12 + f1011 F13) - 
      f1041 f1051 F14 - f1011 f1091 F14 + 
      f10171 (f1081 F11 - f1031 F13 + f1021 F14) + f1031 f1051 F15 - 
      f1021 f1061 F15 + f1011 f1081 F15) *)

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