3

I'm trying to write the expression $$\sum_{\alpha,\beta = 1}^{4}\epsilon_{\mu \nu\alpha\beta}a^{\nu} b^{\alpha} c^{\beta}$$ in Mathematica, where $\epsilon$ is the Levi-Civita symbol and $a$, $b$, $c$ are 4-dimensional vectors.

I tried this but the problem is with Levi-Civita as $\mu$ and $\nu$ are not specified in advance

a = {a1, a2, a3, a4}; 
b = {b1, b2, b3, b4}; 
c = {c1, c2, c3, c4};

Sum[
  LeviCivitaTensor[4][[mu, nu, alpha, beta]] a[[nu]] b[[alpha]] c[[beta]],
  {alpha, 1, 4}, {beta, 1, 4}
]
Teake Nutma
  • 5,981
  • 1
  • 25
  • 49

3 Answers3

7

Assuming $\mu$ and $\nu$ also run from 1 to 4 (which they have to, otherwise your expression doesn't make sense), you can simply take a cue from this Q&A and write

TensorContract[
  TensorProduct[LeviCivitaTensor[4], a, b, c],
  {{2, 5}, {3, 6}, {4, 7}}
] // Normal
{
 -a4 b3 c2 + a3 b4 c2 + a4 b2 c3 - a2 b4 c3 - a3 b2 c4 + a2 b3 c4, 
  a4 b3 c1 - a3 b4 c1 - a4 b1 c3 + a1 b4 c3 + a3 b1 c4 - a1 b3 c4, 
 -a4 b2 c1 + a2 b4 c1 + a4 b1 c2 - a1 b4 c2 - a2 b1 c4 + a1 b2 c4,  
  a3 b2 c1 - a2 b3 c1 - a3 b1 c2 + a1 b3 c2 + a2 b1 c3 - a1 b2 c3
}

This is actually the same output as in @QuantomDot's answer.

Teake Nutma
  • 5,981
  • 1
  • 25
  • 49
6

You need to construct a "table" that acts like a vector

a = {a1, a2, a3, a4}; b = {b1, b2, b3, b4}; c = {c1, c2, c3, c4};
Table[
   Sum[LeviCivitaTensor[4][[mu, nu, alpha, beta]] 
        a[[nu]] b[[alpha]] c[[beta]], {alpha, 1, 4}, {beta, 1, 4}, {nu, 1, 4}], 
  {mu, 1, 4}]
QuantumDot
  • 19,601
  • 7
  • 45
  • 121
4

In the question, there is no summation over $\nu$, as there is in other answers. In case $\nu$ is not specified, as the OP explicitly states, and meant to be an index, here is a way to calculate the desired tensor without using Table and Sum.

SymbolicTensors`ArrayContract[
  TensorContract[
    a \[TensorProduct] b \[TensorProduct] c \[TensorProduct] LeviCivitaTensor[4],
    {{2, 6}, {3, 7}}],
 {{1, 3}}, List]

One can compare its output with the output of Table -- they're the same:

Table[
 Sum[Signature[{mu, nu, alpha, beta}] a[[nu]] b[[alpha]] c[[beta]], {alpha, 4}, {beta, 4}],
 {mu, 4}, {nu, 4}]
(*
  {{ 0,  -a2 b4 c3 + a2 b3 c4,  a3 b4 c2 - a3 b2 c4, -a4 b3 c2 + a4 b2 c3},
   { a1 b4 c3 - a1 b3 c4,  0,  -a3 b4 c1 + a3 b1 c4,  a4 b3 c1 - a4 b1 c3},
   {-a1 b4 c2 + a1 b2 c4,  a2 b4 c1 - a2 b1 c4,  0,  -a4 b2 c1 + a4 b1 c2},
   { a1 b3 c2 - a1 b2 c3, -a2 b3 c1 + a2 b1 c3,  a3 b2 c1 - a3 b1 c2,  0 }}
*)

Note: LeviCivitaTensor[4][[mu, nu, alpha, beta]] is the same as Signature[{mu, nu, alpha, beta}] (thanks to Szabolcs for pointing it out).

Admittedly, it seems odd not to sum over $\nu$, but I thought I may as well answer the question as it is (currently) stated.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • 1
    Instead of LeviCivitaTensor[...][[mu,nu,alpha,beta]] you can use Signature[{mu,nu,alpha,beta}]. – Szabolcs Sep 08 '14 at 17:31
  • Of course. Thanks. I don't remember but I think I just adapted the OP's or QuantumDot's code. Since QuantumDot's is the accepted answer, your comment might help more visitors there. But I'll use it to improve my answer anyway. :) – Michael E2 Sep 08 '14 at 18:14