Is there a function in Mathematica that generates a list of all plane partitions of a certain dimension $n$? This paper describes the algorithm, but I still find it a bit tricky to do it myself.
1 Answer
$\begingroup$
$\endgroup$
2
It looks like the Wolfram MathWorld Plane Partition page has the algorithm implemented (select "Download Wolfram Notebook"):
<< Combinatorica`
coversQ[parent_, child_] :=
And [ Length[parent] >= Length[child] ,
Min[Take[ parent, Length@child] - child] >= 0]
planepartitionQ[par_] :=
MatchQ[par, {{___Integer} ..}] &&
If[Length[par] > 1,
And @@ MapThread[coversQ, {Drop[par, -1], Rest[par]}],
True]
PlanePartitions[n_Integer] := Module[{l1, l2, l3, l4},
l1 = z @@@ Partitions[n] ;
l2 = l1 /. k_Integer /; (k > 1) :> w @@ Partitions[k];
l3 = l2 /. z[x_w, y : (1 ...)] :> Thread[z[x, y], w] /.
z[x__w] :> Outer[z, x] /.
z[x__w, y : (1 ...)] :>
Outer[z, x, Sequence @@ ({y} /. 1 -> w[1])] /.
w -> Sequence;
l4 = l3 /.
z[x___List, y : (1 ..)] :> z[x, Sequence @@ Transpose[{{y}}]] /.
z -> List;
Cases[Union[l4], _?planepartitionQ]]
Can't speak to its validity or if it's precisely what you're looking for, and it relies on the outdated Combinatorica
package, but it should be a great starting point for what you're after.
-
$\begingroup$ I ran a few tests, and it looks like Combinatorica is not required if you replace
Partitions[...]
withIntegerPartitions[...]
. $\endgroup$ Commented Feb 1, 2018 at 3:52 -
$\begingroup$ That sounds right. Most of the functionality from the package has a built in replacement nowadays. $\endgroup$– ktmCommented Feb 1, 2018 at 3:53