#HomeWork#9 #Please do not post homework #Abrar Almahmeed, Feb.22 #Question 1: NumberOfProperties:=proc(n,L,i) local j,c: c:=0: for j from 1 to nops(L) do if member(i,L[j]) then c:=c+1: fi: od: c: end: NumberOfProperties(4,[{1,3},{2,4},{3,4}],1); 1 NumberOfProperties(4,[{1,3},{2,4},{3,4}],2); 1 NumberOfProperties(4,[{1,3},{2,4},{3,4}],3); 2 NumberOfProperties(4,[{1,3},{2,4},{3,4}],4); 2 #Question 2: PIEgD:=proc(n,L,t): local i,sum: sum:=0: for i from 1 to n do sum:=sum+t^NumberOfProperties(n,L,i): od: sum: end: L:=[{1,3},{2,4},{3,4}]: PIEgD(4,L,t); 2 2 t + 2 t #Question 3: for j from 1 to 5 do L:=RandL(1000,4): print(evalb(PIEg(1000,L,t)=PIEgD(1000,L,t))): od: true true true true true