Re: The Case of the Mystery Option
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1086] Re: The Case of the Mystery Option
- From: Richard Mercer <richard at seuss.math.wright.edu>
- Date: Sun, 14 May 1995 20:21:28 -0400
> Hi Group;
> In Roman Maeder's excellent book Programming in
> Mathematica, on page 100 is an example using the option
> to Transpose. (Up until this moment, I didn't even know
> there was an option with Transpose, but never mind this.)
> In essence, Transpose[mat,{1,1}] returns a list of the
> diagonal entries of the matrix mat. With the exception
> of this one example, I have never seen an illustration
> of the use of this option. So I ask you kind souls to
> answer a few questions for me:
>
> (1) Is it true that the 2nd line on page 132 of The Book
> is a misprint? It says that Transpose[list,n]
> interchanges the top level with the nth level.
>
> (2) From the error messages I have received while
> experimenting with this option, I have deduced that the
> option is a permutation. It permutes levels? Is this
> correct?
>
> (3) How does one explain Maeder's example?
>
> (4) I guess that besides the Maeder example, the only
> other uses appears in Tensors?
>
> As usual, your help is more than appreciated.
>
> Jack
>
Jack,
This "option" to Transpose has many other uses for displaying
multidimensional data tables besides mathematical tensors, though it always
involves "tensors" in the sense of lists satisfying TensorQ. Below is a visual
example of a three-dimensional list display in original form, transpose form,
then using all six permutations. Briefly,
(1) the identity permutation {1,2,3} has no effect (surprise)
(2) the permutation {2,1,3} has the same effect as plain Transpose:
it transposes the large 2x2 "block matrix"
(3) the permutation {1,3,2} has the effect of transposing each of
the "upper" (A) and "lower" (B) block matrices separately
(4) the permutations {2,3,1} and {3,1,2} have the effects, respectively,
of (3) followed by (2), and of (2) followed by (3)
(I think! This is making me dizzy...)
(5) the permutation {3,2,1} "shuffles" the original "upper" (A) and "lower" (B)
block matrices, pairing together matching entries of these blocks.
Richard Mercer
threedeep = Outer[List,{A,B},{1,2},{i,ii}]
{{{{A, 1, i}, {A, 1, ii}}, {{A, 2, i}, {A, 2, ii}}},
{{{B, 1, i}, {B, 1, ii}}, {{B, 2, i}, {B, 2, ii}}}}
TableForm[threedeep]
A 1 i A 2 i
A 1 ii A 2 ii
B 1 i B 2 i
B 1 ii B 2 ii
TableForm[Transpose[threedeep]]
A 1 i B 1 i
A 1 ii B 1 ii
A 2 i B 2 i
A 2 ii B 2 ii
TableForm[Transpose[threedeep,{1,2,3}]]
A 1 i A 2 i
A 1 ii A 2 ii
B 1 i B 2 i
B 1 ii B 2 ii
TableForm[Transpose[threedeep,{1,3,2}]]
A 1 i A 1 ii
A 2 i A 2 ii
B 1 i B 1 ii
B 2 i B 2 ii
TableForm[Transpose[threedeep,{2,1,3}]]
A 1 i B 1 i
A 1 ii B 1 ii
A 2 i B 2 i
A 2 ii B 2 ii
TableForm[Transpose[threedeep,{2,3,1}]]
A 1 i B 1 i
A 2 i B 2 i
A 1 ii B 1 ii
A 2 ii B 2 ii
TableForm[Transpose[threedeep,{3,1,2}]]
A 1 i A 1 ii
B 1 i B 1 ii
A 2 i A 2 ii
B 2 i B 2 ii
TableForm[Transpose[threedeep,{3,2,1}]]
A 1 i A 2 i
B 1 i B 2 i
A 1 ii A 2 ii
B 1 ii B 2 ii