# Combinatorica and DualPartition function (for a Young diagram)

I am trying to understand how to evaluate the arm and leg functions of a Young tableaux using Mathematica. To do so I need the Combinatorica package. Then apparently the command

DualPartition[l_]:=Module[{i},Table[Length[Select[l,(#>=i)&]],{i,1,l[]}]]
DualPartition[{}] = {};


will take as input a Young diagram and will output its dual. I understand that the original Young diagram is defined within the code I include above but due to my lack of experience with Mathematica can you help me understand in detail this command above?

What does the "Module" do and what is $i$ and what is $l$ counting there? And how can I see a specific example of a Young diagram to convince my self, say the Young diagram (2,1) [column, row].

Then the arm and leg functions are given by

get[Y_, i_]:=If[i > Length[Y ], 0, Y [[i]]]
arm[Y_, {i_, j_}]:=get[Y, i] − j
leg[Y_, {i_, j_}]:=get[DualPartition[Y ], j] − i


But I am not sure what "get" of the first line does. Any help with that would also be very useful.

• There were quite some underscores missing in your code... Dec 11, 2015 at 19:37
• Ok, thanks for the help. I did not copy it from a .nb file rather from a Latex one. But any comments on the actual question? Thanks a lot! Dec 11, 2015 at 19:52
• I'm not really familiar with Young tableaux, but from what I learned from the Combinatorica tutorial it looks like your DualPartition is not compatible with the Young tableaux generated in that package. Where did you get that definition of DualPartition from? Dec 11, 2015 at 19:56
• Hi! From here web.science.uu.nl/itf/Teaching/2013/R.J.Rodger.pdf page 71 Dec 12, 2015 at 0:06
• Well, I've been looking at that document, but the definition just seems wrong. An example of a Young diagram would be {{1, 3, 4, 5}, {2}} (the second element of Tableau. Then, after passing this to DualPartition l[] would be {1, 3, 4, 5} and it would mean that the iterator i is supposed to run from 1 (a scalar) to {1, 3, 4, 5} (a vector). That's not possible so l[] must be a scalar and the l must be a one-dimensional list and can't be a Young diagram as delivered by Combinatorica's Tableau. I'm afraid you'll have to ask the author of the paper for an explanation. Dec 12, 2015 at 0:36

It seems the Author of http://web.science.uu.nl/itf/Teaching/2013/R.J.Rodger.pdf uses the term "Young Diagram" to indicate a partition. Normally, the Young diagram is considered graphical a representation of a partition. If all boxes are filled with the concecutive integers 1 .. n, then it's called a (standard) Young Tableau. Rows and columns non-decreasing. If any integer is allowed (up to k) then we call it a Semi-Standard Young Tableau.

In the given context, the 'dual partition' is just the transpose partition. No Tableaux anywhere near. TransposePartition[ ] in Combinatorica.

It is hard to explain your DualPartition code as it does not seem to work on the Young tableaux generated by the Combinatorica package. Let's try to write something ourselves.

Assuming DualPartitioncalculates a conjugate tableau this could be written as follows:

Needs["Combinatorica"]


The Tableau function generates Young tableaux:

Tableaux
(* {{{1, 2, 3, 4, 5}}, {{1, 3, 4, 5}, {2}}, {{1, 2, 4, 5}, {3}},
{{1, 2, 3, 5}, {4}}, {{1, 2, 3, 4}, {5}}, {{1, 3, 5}, {2, 4}},
{{1, 2, 5}, {3, 4}}, {{1, 3, 4}, {2, 5}}, {{1, 2, 4}, {3, 5}},
{{1, 2, 3}, {4, 5}}, {{1, 4, 5}, {2}, {3}}, {{1, 3, 5}, {2}, {4}},
{{1, 2, 5}, {3}, {4}}, {{1, 3, 4}, {2}, {5}}, {{1, 2, 4}, {3}, {5}},
{{1, 2, 3}, {4}, {5}}, {{1, 4}, {2, 5}, {3}}, {{1, 3}, {2, 5}, {4}},
{{1, 2}, {3, 5}, {4}}, {{1, 3}, {2, 4}, {5}}, {{1, 2}, {3, 4}, {5}},
{{1, 5}, {2}, {3}, {4}}, {{1, 4}, {2}, {3}, {5}},
{{1, 3}, {2}, {4}, {5}}, {{1, 2}, {3}, {4}, {5}},
{{1}, {2}, {3}, {4}, {5}}} *)


Formatting it nicely:

 Multicolumn[
Grid[#, Spacings -> {0, 0}] & /@ Map[Framed, Tableaux, {3}]
, 6, Appearance -> "Horizontal"
] The conjugate form can be easily found with an uncommon variety of Flatten (see for instance this question)

Flatten[Tableaux, {{1}, {3}, {2}}]


with formatting:

 Multicolumn[
Grid[#, Spacings -> {0, 0}] & /@
Map[Framed, Flatten[Tableaux, {{1}, {3}, {2}}], {3}]
, 6, Appearance -> "Horizontal"
] • Hi! Thanks a lot for your nice answer. I have two questions though. 1) These diagrams have a redundancy I do not need. That is the boxes should be indistinguishable. How can I achieve this? For example the partition of 3 would have three diagrams if the boxes are indistinguishable while it would have 4 if we labeled them. 2) How can I calculate the arm and leg functions then? Thanks lot. Dec 11, 2015 at 23:55
• As to 1) use Tableaux /. _Integer -> "" // Union instead of Tableaux. As to 2) that should be easy. Given the starting coordinate of the arm and the leg the arm can be picked right away. You may want to look up the functions Part and Span. The leg can be found in a similar way using the conjugate tableaux. Dec 12, 2015 at 0:09
• BTW I just noted that Combinatorica has a function TransposeTableau which does basically generate a dual. Dec 12, 2015 at 0:37

The function Partitions[] in Combinatorica, which the author (Rodger) of http://web.science.uu.nl/itf/Teaching/2013/R.J.Rodger.pdf uses to create the Young diagrams, is now implemented as the System function IntegerPartitions.

Needs["Combinatorica"]
Partitions
(*  {{5}, {4, 1}, {3, 2}, {3, 1, 1}, {2, 2, 1}, {2, 1, 1, 1}, {1, 1, 1, 1, 1}}  *)

IntegerPartitions
(*  {{5}, {4, 1}, {3, 2}, {3, 1, 1}, {2, 2, 1}, {2, 1, 1, 1}, {1, 1, 1, 1, 1}}  *)


The function DualPartition works on this representation of a Young diagram.

DualPartition[{2, 2, 1}]
(*  {3, 2}  *)


Note that there is another undocumented function InternalIntegerPartitions[..], which is equivalent to Tally[IntegerPartitions[..]]. The advantage is that the equivalent of DualPartition also exists, InternalTransposeIntegerPartition.

InternalIntegerPartitions
(*
{{{5, 1}}, {{4, 1}, {1, 1}}, {{3, 1}, {2, 1}}, {{3, 1}, {1, 2}},
{{2, 2}, {1, 1}}, {{2, 1}, {1, 3}}, {{1, 5}}}
*)

InternalTransposeIntegerPartition[Tally[{2, 2, 1}]]      (* Tally converts form *)
% /. {x_Integer, n_Integer} :> Sequence @@ Table[x, {n}]  (* Table etc. convert back *)
(*
{{3, 1}, {2, 1}}
{3, 2}
*)
`