I'm having a great deal of trouble getting started on a weekly homework assignment in Mathematica. The assignment requires we use the epsilon tensor which is apparently built into Mathematica as Signature.

My Mathematica skills are woefully inadequate, and I'm an external student so I can't consult with my peers. The first question is meant to ease us into the assignment, but after looking through Mathematica documentation center, StackExchange answers and other tutorials from other universities I'm no closer to being able to complete it.

If anyone could tell me how to do this first question I should be able to work through the rest of the assignment, but at the moment I just can't get started.

The question (which should be simple, it's weighted very small) is:


  • 2
    $\begingroup$ Have a look at the details and scope section of reference.wolfram.com/mathematica/ref/LeviCivitaTensor.html, might help you. $\endgroup$
    – ciao
    Mar 14 '14 at 7:55
  • 1
    $\begingroup$ Pick a value for i and Sum the expression Signature[{i, j, k}] a[j] b[k] over j and k. $\endgroup$
    – Michael E2
    Mar 14 '14 at 12:09
  • $\begingroup$ Do what Michael said then compare the result with what you'd get from Cross. $\endgroup$
    – Szabolcs
    Mar 14 '14 at 14:58

The symbol $\epsilon$ is called the Levi-Civita tensor, it is usually written in terms of its components $\epsilon_{i j k}$. Having defined two vectors (i.e. first order contravariant tensors):

a = { a1, a2, a3};
b = { b1, b2, b3};

we have to build up a tensor product of two vectors and Levi-Civita tensor, i.e. we get a new tensor of valence $(3,2)$ (i.e. with $3$-covariant $2$-contravariant indices) with components $\epsilon_{i j k} a^l b^m$ and then we have to contract it with respect to appropriate pairs of indices, i.e. we get one covariant (pseudo) tensor with components $\epsilon_{i j k} a^j b^k$ (Einstein summation convention), it is called also pseudovector :

TensorContract[ TensorProduct[ a, b, LeviCivitaTensor[3]], {{1, 3}, {2, 4}}]
{-a3 b2 + a2 b3, a3 b1 - a1 b3, -a2 b1 + a1 b2}

You'll find more detailed discussion here: Contracting with Levi-Civita (totally antisymmetric) tensor.

As a curiosity let's mention that it is also called a cross product which is defined only in three dimensional space, while we can built appropriate tensor product with Levi-Civita tensor in arbitrarily dimensional spaces.

and obviously we have

TensorContract[ TensorProduct[ a, b, LeviCivitaTensor[3]], {{1, 3}, {2, 4}}] == Cross[a, b]


Here is a geometrical representation of the Cross operation acting on two vectors (the blue and green ones) yielding the red vector (see also this answer):

Graphics3D[{Thick, {Blue, Arrow[{{0, 0, 0}, {1, 0, 0}}]}, 
           {Darker @ Green, Arrow[{{0, 0, 0}, {0, 1, 0}}]}, 
           {Red, Arrow[{{0, 0, 0}, Cross[{1, 0, 0}, {0, 1, 0}]}]}}, Boxed -> False]

enter image description here

One should also remember that there is the curl operator, usually written in terms of a contraction of Levi-Civita tensor with partial (or covariant) derivatives of a vector field. In Mathematica we have the Curl function. It is especially useful in three dimensional vector calculus, in physics we can express the Maxwell equations using vector calculus in more elegant way than the traditional notation allows.
Here we provide geometrical representation of the curl operator acting on this vector field:

v[x_, y_, z_] := 1/Sqrt[x^2 + y^2] {-y, x, 0}

On the left we have appropriately restricted vector field v and on the right its curl:

  VectorPlot3D[ #1, {x, -1, 1}, {y, -1, 1}, {z, -1/5, 1/5}, 
                VectorStyle -> {#3, "Arrow3D", Thick}, VectorScale -> #2, 
                RegionFunction -> (-0.9 < #1 < 0.9 && -0.9 < #2 < 0.9 && 0 < #3 < 1/15 &),
                BoxRatios -> Automatic, Evaluated -> True, 
                PlotRange -> {{-1, 1}, {-1, 1}, {-1/4, 1/4}}]& @@@ {
    { v[x, y, z], 0.08, Blue}, {Curl[v[x, y, z], {x, y, z}], 0.15, Darker @ Cyan}}]

enter image description here


Here are two ways to calculate the cross product:

Table[Sum[Signature[{i, j, k}] a[j] b[k], {j, 3}, {k, 3}], {i, 3}]

Cross[Array[a, 3], Array[b, 3]]

Both return

{-a[3] b[2] + a[2] b[3], a[3] b[1] - a[1] b[3], -a[2] b[1] + a[1] b[2]}

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.