tensor(deprecated)/permute_indices - Maple Help

tensor

 permute_indices
 Permutation of the indices of a tensor_type

 Calling Sequence permute_indices(T, permutation)

Parameters

 T - tensor_type on which to perform permutation permutation - permutation according to which the re-indexing of the indices is to be done

Description

Important: The tensor package has been deprecated. Use the superseding command DifferentialGeometry[Tensor][RearrangeIndices].

 • This procedure allows you to change the way a given tensor_type is indexed.  Given any permutation of the indices of a tensor_type and a tensor, the routine will re-index the tensor according to the given permutation.
 • T must be of rank 2 or more.
 • permutation is a list of indices (integers ranging from 1 to rank(T)) with no duplications and size equal to the rank of T.  It is used to specify the re-indexing of the tensor in the following way: The nth' index of the original tensor is moved to the position of n' in the permutation.  For example, a permutation list of $\left[3,1,2\right]$ specifies that the third index of the original tensor will be the first index of the re-indexed tensor, the first index of the original tensor will be the second index of the re-indexed tensor, and the second index of the original tensor will be the third index of the re-indexed tensor (that is,  i,j,k --> k,i,j).
 • This function is occasionally useful because of the rigidity in default indexing of the other utility routines, like prod, contract, and cov_diff, of the tensor package.  Since you can have a preferred indexing different from the default, and switching back and forth between the two conventions could be confusing during a substantial computation, it is advised that you perform a re-ordering of indices of any computed tensor_type to comply with your indexing convention, whenever the default indexing is different from the one with which you are comfortable.
 • Note that any symmetrical properties of the indices of the input are not preserved in the re-indexed indices of the result.
 • This function is part of the tensor package, and so can be used in the form permute_indices(..) only after performing the command with(tensor) or with(tensor, permute_indices).  The function can always be accessed in the long form tensor[permute_indices](..).

Examples

Important: The tensor package has been deprecated. Use the superseding command DifferentialGeometry[Tensor][RearrangeIndices].

 > $\mathrm{with}\left(\mathrm{tensor}\right):$

Find the transpose of a rank 2 tensor.

 > $\mathrm{A_compts}≔\mathrm{array}\left(1..3,1..3\right):$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}3\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}j\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}3\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{A_compts}\left[i,j\right]≔\mathrm{cat}\left('a',i,j\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}:$$A≔\mathrm{create}\left(\left[1,-1\right],\mathrm{op}\left(\mathrm{A_compts}\right)\right)$
 ${A}{≔}{table}{}\left(\left[{\mathrm{compts}}{=}\left[\begin{array}{ccc}{\mathrm{a11}}& {\mathrm{a12}}& {\mathrm{a13}}\\ {\mathrm{a21}}& {\mathrm{a22}}& {\mathrm{a23}}\\ {\mathrm{a31}}& {\mathrm{a32}}& {\mathrm{a33}}\end{array}\right]{,}{\mathrm{index_char}}{=}\left[{1}{,}{-1}\right]\right]\right)$ (1)
 > $\mathrm{A_transpose}≔\mathrm{permute_indices}\left(A,\left[2,1\right]\right)$
 ${\mathrm{A_transpose}}{≔}{table}{}\left(\left[{\mathrm{compts}}{=}\left[\begin{array}{ccc}{\mathrm{a11}}& {\mathrm{a21}}& {\mathrm{a31}}\\ {\mathrm{a12}}& {\mathrm{a22}}& {\mathrm{a32}}\\ {\mathrm{a13}}& {\mathrm{a23}}& {\mathrm{a33}}\end{array}\right]{,}{\mathrm{index_char}}{=}\left[{-1}{,}{1}\right]\right]\right)$ (2)

Perform a cyclic permutation on a rank 3 tensor.

 > $\mathrm{B_compts}≔\mathrm{array}\left(1..3,1..3,1..3\right):$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}3\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}j\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}3\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}k\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}3\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{B_compts}\left[i,j,k\right]≔\mathrm{cat}\left('b',i,j,k\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}:$$B≔\mathrm{create}\left(\left[1,-1,1\right],\mathrm{op}\left(\mathrm{B_compts}\right)\right)$
 ${B}{≔}{table}{}\left(\left[{\mathrm{compts}}{=}{array}{}\left({1}{..}{3}{,}{1}{..}{3}{,}{1}{..}{3}{,}\left[\left({1}{,}{1}{,}{1}\right){=}{\mathrm{b111}}{,}\left({1}{,}{1}{,}{2}\right){=}{\mathrm{b112}}{,}\left({1}{,}{1}{,}{3}\right){=}{\mathrm{b113}}{,}\left({1}{,}{2}{,}{1}\right){=}{\mathrm{b121}}{,}\left({1}{,}{2}{,}{2}\right){=}{\mathrm{b122}}{,}\left({1}{,}{2}{,}{3}\right){=}{\mathrm{b123}}{,}\left({1}{,}{3}{,}{1}\right){=}{\mathrm{b131}}{,}\left({1}{,}{3}{,}{2}\right){=}{\mathrm{b132}}{,}\left({1}{,}{3}{,}{3}\right){=}{\mathrm{b133}}{,}\left({2}{,}{1}{,}{1}\right){=}{\mathrm{b211}}{,}\left({2}{,}{1}{,}{2}\right){=}{\mathrm{b212}}{,}\left({2}{,}{1}{,}{3}\right){=}{\mathrm{b213}}{,}\left({2}{,}{2}{,}{1}\right){=}{\mathrm{b221}}{,}\left({2}{,}{2}{,}{2}\right){=}{\mathrm{b222}}{,}\left({2}{,}{2}{,}{3}\right){=}{\mathrm{b223}}{,}\left({2}{,}{3}{,}{1}\right){=}{\mathrm{b231}}{,}\left({2}{,}{3}{,}{2}\right){=}{\mathrm{b232}}{,}\left({2}{,}{3}{,}{3}\right){=}{\mathrm{b233}}{,}\left({3}{,}{1}{,}{1}\right){=}{\mathrm{b311}}{,}\left({3}{,}{1}{,}{2}\right){=}{\mathrm{b312}}{,}\left({3}{,}{1}{,}{3}\right){=}{\mathrm{b313}}{,}\left({3}{,}{2}{,}{1}\right){=}{\mathrm{b321}}{,}\left({3}{,}{2}{,}{2}\right){=}{\mathrm{b322}}{,}\left({3}{,}{2}{,}{3}\right){=}{\mathrm{b323}}{,}\left({3}{,}{3}{,}{1}\right){=}{\mathrm{b331}}{,}\left({3}{,}{3}{,}{2}\right){=}{\mathrm{b332}}{,}\left({3}{,}{3}{,}{3}\right){=}{\mathrm{b333}}\right]\right){,}{\mathrm{index_char}}{=}\left[{1}{,}{-1}{,}{1}\right]\right]\right)$ (3)
 > $C≔\mathrm{permute_indices}\left(B,\left[3,1,2\right]\right)$
 ${C}{≔}{table}{}\left(\left[{\mathrm{compts}}{=}{array}{}\left({1}{..}{3}{,}{1}{..}{3}{,}{1}{..}{3}{,}\left[\left({1}{,}{1}{,}{1}\right){=}{\mathrm{b111}}{,}\left({1}{,}{1}{,}{2}\right){=}{\mathrm{b121}}{,}\left({1}{,}{1}{,}{3}\right){=}{\mathrm{b131}}{,}\left({1}{,}{2}{,}{1}\right){=}{\mathrm{b211}}{,}\left({1}{,}{2}{,}{2}\right){=}{\mathrm{b221}}{,}\left({1}{,}{2}{,}{3}\right){=}{\mathrm{b231}}{,}\left({1}{,}{3}{,}{1}\right){=}{\mathrm{b311}}{,}\left({1}{,}{3}{,}{2}\right){=}{\mathrm{b321}}{,}\left({1}{,}{3}{,}{3}\right){=}{\mathrm{b331}}{,}\left({2}{,}{1}{,}{1}\right){=}{\mathrm{b112}}{,}\left({2}{,}{1}{,}{2}\right){=}{\mathrm{b122}}{,}\left({2}{,}{1}{,}{3}\right){=}{\mathrm{b132}}{,}\left({2}{,}{2}{,}{1}\right){=}{\mathrm{b212}}{,}\left({2}{,}{2}{,}{2}\right){=}{\mathrm{b222}}{,}\left({2}{,}{2}{,}{3}\right){=}{\mathrm{b232}}{,}\left({2}{,}{3}{,}{1}\right){=}{\mathrm{b312}}{,}\left({2}{,}{3}{,}{2}\right){=}{\mathrm{b322}}{,}\left({2}{,}{3}{,}{3}\right){=}{\mathrm{b332}}{,}\left({3}{,}{1}{,}{1}\right){=}{\mathrm{b113}}{,}\left({3}{,}{1}{,}{2}\right){=}{\mathrm{b123}}{,}\left({3}{,}{1}{,}{3}\right){=}{\mathrm{b133}}{,}\left({3}{,}{2}{,}{1}\right){=}{\mathrm{b213}}{,}\left({3}{,}{2}{,}{2}\right){=}{\mathrm{b223}}{,}\left({3}{,}{2}{,}{3}\right){=}{\mathrm{b233}}{,}\left({3}{,}{3}{,}{1}\right){=}{\mathrm{b313}}{,}\left({3}{,}{3}{,}{2}\right){=}{\mathrm{b323}}{,}\left({3}{,}{3}{,}{3}\right){=}{\mathrm{b333}}\right]\right){,}{\mathrm{index_char}}{=}\left[{1}{,}{1}{,}{-1}\right]\right]\right)$ (4)