1)  Load the package "zof.m"

<< zof.m; (* this is to load the package "zof.m ", which has to be put in the same directory as "zof.nb" *)

2) Input some Ferrers boards and 0-1-fillings (zof)

fb1 = {5, 5, 5, 3} (* we input a Ferrers board by a list in reverse sorted order, which appears in Exampe 1 of Ting's note *)

tfb1 = fbTableForm[fb1] (* we may translate fb1 into table form as that in Example 1 of Ting's note *)

ttfb1 =TableForm[tfb1] (* for visualization, we may apply the command "TableForm" to tfb1, this is what we see in Example 1 of Ting's note *)

?fbTableForm

(* the above command gives the functionality of fbTableForm *)

zof1 = {{0, 1, 0}, {1, 0, 0, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1,0}} (* we input a 0-1-filling of fb1, which appears in Example 1 of Ting's note *)

tzof1 = TableForm[zof1](* for visualization, we may apply the command "TableForm" to zof1, this is what we see in Example 1 of Ting's note *)

fb2 = {5, 5, 5, 5, 5} (* we input a Ferrers board by a list in reverse sorted order, which appears in Exampe 2 of Ting's note *)

tfb2 = fbTableForm[fb2] (* we may translate fb2 into table form as that in Example 2 of Ting's note *)

ttfb2 =TableForm[tfb2] (* for visualization, we may apply the command "TableForm" to tfb2, this is what we see in Example 2 of Ting's note *)

zof2 = {{0,1, 0, 0, 0}, {0,0,0,0,1},{1,0,0,0,0}, {0,0,0,1,0}, {0,0, 1,0,0}}(* we input a 0-1-filling of fb2, which appears in Example 2 of Ting's note *)

tzof2 = TableForm[zof2](* for visualization, we may apply the command "TableForm" to zof2, this is what we see in Example 2 of Ting's note *)

sigma2 = {3, 5, 1, 2, 4} (* sigma2 is a permutation which corresponds to zof2 *)

m2 = SigmaMatrix[sigma2] (* we may translate sigma2 into a matrix form, which appears in Example 2 of Ting's note *)

TableForm[m2] (* for visualization, we may apply the command "TableForm" to m2, this is what we see in Example 2 of Ting's note *)

zof2 == m2 (* zof2 is equal to m2 *)

?SigmaMatrix

(* the above command gives the functionality of SigmaMatrix *)

3) Given a Ferrers board, generate all its 0-1-fillings

fb1 (* this is the Ferrers board in Exmple 1 of Ting's note *)

?zofGenerator

(* the above command gives the functionality of zofGenerator *)

zofs1 = zofGenerator[fb1]; (* generate all the 0-1-fillings of fb1 *)

Length[zofs1] (* fb1 has 126 0-1-fillings *)

TableForm[zof1] (* zof1 is the Ferrers board in Exmple 1 of Ting's note*)

Do[ If[zofs1[[i]] == zof1, Print[i]; Break[]],{i, Length[zofs1]}]; (* check whether zof1 is among zofs1*)

TableForm[zofs1[[55]]] (* the visualization of zofs1[[55]]]*)

zof1 == zofs1[[55]] (* check zof1 is equal to zofs1[[55]] or not *)

fb2 (* this is the Ferrers board in Exmple 2 of Ting's note *)

zofs2 = zofGenerator[fb2]; (* generate all the 0-1-fillings of fb2 *)

Length[zofs2] (* fb2 has 120 0-1-fillings *)

TableForm[zof2] (* zof2 is the Ferrers board in Exmple 2 of Ting's note*)

Do[ If[zofs2[[i]] == zof2, Print[i]; Break[]],{i, Length[zofs2]}]; (* check whether zof2 is among zofs2*)

TableForm[zofs2[[54]]] (* the visualization of zofs2[[54]]]*)

zof2 == zofs2[[54]] (* check zof2 is equal to zofs2[[54]] or not *)

4) Given a Ferrers board  fb and a permutation sigma,count the number of sigma-avoiding zofs of  fb

fb3 = {3, 3, 2} (* this is the Ferrers board in Exampe 3 of Ting's note *)

tfb3 = fbTableForm[fb3] (* translate fb3 into the table form *)

TableForm[tfb3](* visualization of tfb3 *)

zof3 ={{0, 1}, {0, 0, 1}, {1, 0, 0}}(* this is the 0-1-filling in Exampe 3 of Ting's note *)

TableForm[zof3] (* visualization of zof3 *)

?fbSubSquare

(* the above command gives the functionality of fbSubSquare *)

fbsq3 =fbSubSquare[fb3, 2]; (* this is to generate a list of lists of indices of sub square matrices of fb3 of dimension 2*)

Length[fbsq3](* there are 5 sub square matrices of fb of dimension 2 *)

?SigmaAvoidingTest

(* the above command gives the functionality of SigmaAvoidingTest *)

sigma3 ={1, 2} (* this is the permutation (12) in Example 3 of Ting's note *)

SigmaAvoidingTest[zof3, sigma3, fbsq3] (* this means zof3 is not 12-avoiding *)

sigma4 ={2, 1} (* this is the permutation (21) in Example 3 of Ting's note *)

SigmaAvoidingTest[zof3, sigma4, fbsq3] (* this means zof3 is 21-avoiding *)

fb4 = {6, 6, 6, 4} (* this is the Ferrers board in Exampe 4 of Ting's note *)

tfb4 = fbTableForm[fb4] (* translate fb4 into the table form *)

TableForm[tfb4] (* visualization of tfb4 *)

fbsq4 =fbSubSquare[fb4, 3]; (* this is to generate a list of lists of indices of sub square matrices of fb4 of dimension 3*)

Length[fbsq4](* there are 32 sub square matrices of fb of dimension 2 *)

zof4 = {{1, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0,0,1,0,1, 1}, {0,0,0,1,0,0}}(* this is the first 0-1-filling in Exampe 4 of Ting's note *)

TableForm[zof4](* visualization of zof4 *)

sigma5 = {2, 3, 1}

SigmaAvoidingTest[zof4, sigma5, fbsq4] (* this means zof4 is 231-avoiding *)

zof5 = {{1, 0, 0, 0}, {0, 1, 1,0,1,0}, {0,0,0, 1,0,0},{0, 0, 0, 0, 0, 1}}(* this is the second 0-1-filling in Exampe 4 of Ting's note *)

TableForm[zof5] (* visualization of zof5 *)

sigma6= {3, 1,2} (* input the permutation (312) *)

SigmaAvoidingTest[zof5, sigma6, fbsq4](* this means zof5 is 312-avoiding *)

?SigmaAvoidingNumber

(* the above command gives the functionality of SigmaAvoidingTest *)

SigmaAvoidingNumber[fb4, sigma5] (* this means fb4 has 425 231-avoiding zofs *)

SigmaAvoidingNumber[fb4, sigma6] (* this means fb4 has 429 312-avoiding zofs *)

?SigmaAvoidingzof

(* the above command gives the functionality of SigmaAvoidingTest *)

zofs3 = SigmaAvoidingzof[fb4, sigma5];(* this gives a list of zofs of fb4 which are 231-avoiding zofs *)

Length[zofs3] (* there are 425 231-avoiding zofs of fb4 *)

Do[ If[zofs3[[i]] == zof4, Print[i]; Break[]],{i, Length[zofs3]}];(* check whether zof4 is among zofs3*)

TableForm[zofs3[[66]]] (* the visualization of zofs3[[66]]]*)

zof4 == zofs3[[66]] (* check zof4 is equal to zofs3[[66]] or not *)

zofs4 = SigmaAvoidingzof[fb4, sigma6];(* this gives a list of zofs of fb4 which are 312-avoiding zofs *)

Length[zofs4] (* there are 429 312-avoiding zofs of fb4 *)

Do[ If[zofs4[[i]] == zof5, Print[i]; Break[]],{i, Length[zofs4]}];(* check whether zof5 is among zofs3*)

TableForm[zofs4[[33]]] (* the visualization of zofs4[[33]]]*)

zof5 == zofs4[[33]] (* check zof5 is equal to zofs4[[33]] or not *)

5) Given a Ferrers board  fb and weight n, generate all the generalized 0-1-fillings of fb with weight n

fb5 = {7, 7, 7, 4, 3, 3} (* this is the Ferrers board in Figure 1 of Ting's note *)

n = 7 (* weight, which is the sum of 1's in a generalized 0-1-fillings of fb5 *)

?ZeroOneFilling

gzof = ZeroOneFilling[fb5, n];

Length[gzof]

TableForm[gzof[[1]]]

6) Given a Ferrers board  fb and weight n, count the number of generalized 0-1-fillings of fb with weight n such that the longest ne-chain has length u and the longest se-chain has length v

fb4 = {6, 6, 6, 4} (* this is the Ferrers board in Exampe 4 of Ting's note *)

?NumberNESE

Do[Print[{NumberNESE[fb4, i, 3, 4], NumberNESE[fb4, i, 4, 3]}], {i, 6, 22}]

7) Given a Ferrers board  fb , count the number of 0-1-fillings of fb such that the longest ne-chain has length u and the longest se-chain has length v

fb4 = {6, 6, 6, 4} (* this is the Ferrers board in Exampe 4 of Ting's note *)

?zofNESE

Do[Do[Print[{zofNESE[fb4, u, v], zofNESE[fb4, v, u]}], {u, v}], {v, 4}]

8) Given a Ferrers board  fb and a partition par, count the number of 0-1-fillings of fb  which fit par ,the longest ne-chain has length u and the longest se-chain has length v

fb6 = {7, 7, 6, 4} (* a Ferrers board *)

?ParGenerator

par = ParGenerator[fb6]

?zofParNESE

Do[Do[Print[{zofParNESE[fb6,par[[1]], u, v], zofParNESE[fb6,par[[1]], v, u]}], {u, v}], {v, 4}]