5
$\begingroup$

What is the easiest way to perform Rotation for Higher Order Tensors in Mathematica ? For Instance 4th order tensor

$C_{ijkl} = \lambda_{im}\lambda_{jn}\lambda_{ko}\lambda_{lp} C_{mnop}$

$\endgroup$
3

1 Answer 1

2
$\begingroup$

There are multiple ways of implementing something like this, and the comments above give you good suggestions. Let me suggest another simple method, which is valid for arrays of any depth, not just 4. This contracts (the second level of) the matrix m on all levels of the array a

multiDot[m_, a_] := With[{d = ArrayDepth[a]},
  Nest[Transpose[m.#, RotateRight[Range[d]]] &, a, d]
]

Take for example a random rotation r and a random array c of depth 4 with the symmetries of an elasticity tensor:

r = RotationMatrix[RandomReal[2 Pi], RandomReal[1, 3]];
c = Normal@ SymmetrizedArray[_ :> RandomReal[1], {3, 3, 3, 3}, {{{2, 1, 3, 4}, 1}, {{1, 2, 4, 3}, 1}, {{3, 4, 1, 2}, 1}}];

Then we can check the preservation of symmetry under the rotation:

rc = multiDot[r, c]

TensorSymmetry[rc] === TensorSymmetry[c]
(* True *)

You can use arrays of any depth in the second argument. Check for example:

multiDot[r, r] == r.r.Transpose[r]
(* True *)
$\endgroup$
2
  • $\begingroup$ how to define a double-dot product between two fourth order tensors in ONE short command line in MMA $\endgroup$
    – ABCDEMMM
    Commented Mar 23, 2022 at 10:24
  • $\begingroup$ I'm not sure how you define such operation. What's the order in which the indices of the two tensors are used? $\endgroup$
    – jose
    Commented Mar 24, 2022 at 19:58

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