#Please do not post homework #Guy Adami, 2026-02-22, Assignment 9 #————— with(combinat) #————— #RandL(n,k): A random list of subsets of {1, ...,n} of length k RandL:=proc(n,k) local i: [seq( randcomb(n, rand(2..n-2)()), i=1..k)]: end: #————— #PIEd(n,L): What the PIE computes, done directly PIEd:=proc(n,L) local i: nops({seq(i,i=1..n)} minus {seq(op(L[i]),i=1..nops(L))}): end: #————— IntL:=proc(L) local i: `intersect`(seq(L[i],i=1..nops(L))): end: #————— #PIE(n,L): PIE:=proc(n,L) local k,cu,S,s: cu:=n: for k from 1 to nops(L) do S:=choose(L,k): cu:=cu+(-1)^k*add(nops(IntL(s)), s in S): od: cu: end: #————— #PIEg(n,L,t): The weight-enumerator of the members of the universal set #according to t^#NumberOfProperties PIEg:=proc(n,L,t) local k,cu,S,s: cu:=n: for k from 1 to nops(L) do S:=choose(L,k): cu:=cu+(t-1)^k*add(nops(IntL(s)), s in S): od: expand(cu): end: #—————————————————————————————————————————————————— #Question 1 NumberOfProperties:=proc(n,L,i) local counter, j, k: counter:= 0: for j from 1 to nops(L) do for k from 1 to nops(L[j]) do if i = L[j][k] then counter:= counter + 1: fi: od: od: counter; end: #————— #Question 2 PIEgD := proc(n, L, t) local T, i, j, NumProps; NumProps := []: for i to n do NumProps := [op(NumProps), NumberOfProperties(n, L, i)]; od: T := sum(t^NumProps[j], j = 1 .. n); T; end: #————— #Question 3 #L:=RandL(1000,4): #evalb(PIEg(1000,L,t)=PIEgD(1000,L,t)); #This evaluation held true all 5 times