#Homework by Mike Murr #OK to post #hw7 currentdir("/Users/michaelmurr/Documents/Mike/Experimental Math"); read `C7.txt`; #counts(n): Displays the number of set-partitions of {1,…,n} into k #parts, where k ranges from 1 to n counts := proc(n) local k; seq(NuSPnk(n,k),k=1..n); end proc; NuSPnk(2,1); NuSPnk(2,2); counts(2); counts(3); counts(4); counts(5); #ChooseK(n): Uses LD (Loaded Die) to choose a value for k ChooseK :=proc(n) local k; LD([seq(NuSPnk(n,k),k=1..n)]); end proc; ChooseK(5); ChooseK(5); ChooseK(5); #RandSPn(n): Inputs a positive integer n and outputs a (uniformly) # at random set partition of {1,…,n} RandSPn := proc(n) local k, kk; kk := ChooseK(n); print(kk); RandSPnk(n,kk); end proc; RandSPn(5); RandSPn(5);