Skip to content

Instantly share code, notes, and snippets.

@arleighdickerson
Last active August 29, 2015 14:06
Show Gist options
  • Save arleighdickerson/7130a5af333bcc05343e to your computer and use it in GitHub Desktop.
Save arleighdickerson/7130a5af333bcc05343e to your computer and use it in GitHub Desktop.
Create nonstandard tableaux, filter by a predicate, and print french style
ClearAll["Global`"];
Quiet[Needs["Combinatorica`"]];
(********************************** Definitions. Don't change unless you know what you are doing. *)
(**
* Map a function2 across a collection
*)
Map2=#@@@Partition[#2,2,1]&;
(**
* Are the elements of a list weakly decreasing (non-increasing) ordinally?
*)
WeaklyIncreasingQ[list_]:=If[Length[list]<2,True,And@@Table[list[[i-1]]<=list[[i]],{i,2,Length[list]}]]
(**
* Are the values of all rows of a tableau weakly increasing?
*)
WeaklyIncreasingRows[t_]:=And @@ WeaklyIncreasingQ /@ t;
(**
* Are the values of all columns of a tableau weakly increasing?
*)
WeaklyIncreasingColumns[t_]:= WeaklyIncreasingRows[TransposeTableau[t]];
(**
* Plot a tableau French style.
*)
PlotTableau[t_]:=Grid[Reverse[t]/.i_Integer->Item[i,Frame->Blue],Alignment->Right](*French*);
(******************************************************** Program parameters. Change as appropriate.*)
(**
* What partition are we interested in?
*)
λ = {3,2,3};
(**
* What makes a single tableau "interesting"? Return True if it is interesting, False if boring.
*)
InterestedIn[tableau_]:=WeaklyIncreasingRows[tableau] && WeaklyIncreasingColumns[tableau];
(*Perform calculations and filter results by interest. Don't change unless you know what you are doing*)
ranges = Map2[Range[#1+1,#2]&,Accumulate[Prepend[λ,0]]];
permutations = Permutations[Range[1,Total[λ]]];
f = Function[p,p[[#]]&/@ranges];
allTableaux = f/@ permutations;
(*select the interesting ones *)
results = Select[allTableaux,InterestedIn];
(*Plot the results*)
PlotTableau/@results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment