In the "Applications" part of TensorTranspose, it is given an example on the calculation of Christoffel according to metrics. I am confused about the definition of gradg231, which is

gradg231 = TensorTranspose[gradg123, {2, 3, 1}]

In my opinion, this should be

TensorTranspose[gradg123, {3, 1, 2}]

According to the function Permute, we can check that

Permute[{a, b, c}, {3, 1, 2}] (* output is {b, c, a} *)


Permute[{a, b, c}, {2, 3, 1}] (* output is {c, a, b} *)

Any comments would be helpful here.

  • 1
    $\begingroup$ If you prefer your convention ("permute the indices", as Itai put it) to Mathematica's "permute the slots" convention, you can use InversePermutation[] as a conversion method: TensorTranspose[gradg123, {2, 3, 1}] == TensorTranspose[gradg123, InversePermutation[{3, 1, 2}]] $\endgroup$ – J. M.'s discontentment Mar 27 at 11:05
  • $\begingroup$ Thanks for your answer! I'll check your method. $\endgroup$ – Mark_Phys Mar 27 at 15:22

One of the classic confusions. Whenever I write these examples I always have to triple check myself so as to not mess up.

There are two ways to think about tensor transposition. Are you permuting the indices (symbols), or are you permuting the slots (in the multilinear map) themselves? These two views are inverses of each other. (This is a variant of "active versus passive" coordinate transformations.) To add to the confusion, both appear in the literature with little to no comment.

TensorTranpose is firmly in the second camp, transposing the slots themselves. So here's a concrete way to think about it. In gradg123, the derivative is in the third slot. In the last term in the formula, the derivative is in the first slot. Thus, we have to move slot 3 to slot 1. This pushes the other slots to 2 and 3, and since they are in the same order we have 1 goes to 2 and 2 goes to 3. Hence, the permutation is {2,3,1}.

A way to double check our work is to compute the symmetry of the final result. If we do this for what's in the example, we get the expect symmetry in the second and third slots (the always covariant ones):

TensorSymmetry[1/2 (gradg123 + gradg132 - gradg231)]
(* Symmetric[{2, 3}] *)

With your suggested modification to gradg231, we get symmetry (possibly just because of the large number zeroes) in the wrong slots:

TensorSymmetry[1/2 (gradg123 + gradg132 - gradg231Alt)]
(* Symmetric[{1, 2}] *)

So I it got right. Phew!

| improve this answer | |

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.