#OK to post homework #Michael Yen, 10/18/20, Assignment 12 #1) By iterating procedure CP(L1,L2), in #M12.txt #write a procedure #CPg(L) #that inputs a list of lists L=[L1,L2, ...,Lk] of "databases" (represented as lists L1, L2, ..., Lk) and outputs #CP(L1,L2, ..., Lk) #In particular, CPg([L1,L2]) should output the same as CP(L1,L2) for any two lists of integers L1 and L2 CPg:=proc(L) local i,j,n,sum,L2: option remember: L2:=[]: n:=nops(L): for i from 1 to n do: for j from i+1 to n do: L2:=[op(L2),op(CP(L[i],L[j]))]: od: od: L2: end: #2) Procedures AveClever(L) and kthMomentClever(L,k) inputs a database L, and first finds its weight-enumerator. #Suppose that you already know the weight-enumerator, call it f, in the variable x. Modify these procedures to #write procedures #AveGF(f,x) and kthMomentGF(f,x,k) #that do the same things if you already have the weight-enumerator f (in terms of x). #In particular, for any "data-base" L, check that #AveGF(WtEn(L,x),x)= AveClever(L) #and #kthMomentGF(WtEn(L,x),x,k)= kthMomentClever(L,k) AveGF:=proc(f,x) option remember: subs(x=1,diff(f,x))/subs(x=1,f): end: kthMomentGF:=proc(f,x,k) local mu,f1,i: option remember: mu:=AveGF(f,x): f1:=f/x^mu/subs(x=1,f): for i from 1 to k do f1:=expand(x*diff(f1,x)): od: subs(x=1,f1): end: #3) The scaled moment about the mean of a "random variable" X (in other words some numerical attribute on a #combinatorial) set, defined on a "sample spaces" is defined by #m_k(X)/m_2(X)^(k/2) #, where m_k(X) is the k-th moment about the mean. #Write a procedure #ScaledMomentGF(f,x,k) #that compute it, given the weight-enumerator (alias generating-function) ScaledMomentGF:=proc(f,x,k) local m_k,m_2: option remember: m_k:=kthMomentGF(f,x,k): m_2:=kthMomentGF(f,x,2): m_k/m_2^(k/2): end: #4) We proved in class that the weight-enumerator of the set of words in the alphabet {0,1} of length n, according #to their sum (equivalently, the number of 1-s) is (1+x)n #Leaving n as a symbol, use Maple to find explicit expressions for #ScaledMomentGF(((1+x)/2)^n,x,k), k=2,3,4,5,6,7,8,9,10 #Then take limits as n goes to infinity (using the Maple command lim( ..., n=infinity)) Get a sequence of numbers. #What is it? #Is it in the OEIS? #[seq(limit(ScaledMomentGF(((1 + x)/2)^n, x, k), n = infinity), k = 2 .. 10)]; #[1, 0, 3, 0, 15, 0, 105, 0, 945] #Yes, this is in the OEIS with A number A123023.