Lecture 12: Due Oct. 18, 9:00pm. Email ShaloshBEKhad@gmail.com an attachment hw12FirstLast.txt OK to post 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. Answer: CPg:=proc(L) local list, i: option remember: list:=CP(L[1],L[2]): for i from 3 to nops(L) do: list:=CP(l1,i): od: return list: 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) Answer: AveGF:=proc(f, x): subs(x=1,diff(f,x))/subs(x=1,f): end: kthMomentGF:=proc(f,x,k) local mu,f1,i: 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) Answer: ScaledMomentGF:=proc(f,x,k) local a, b: a:=kthMomentGF(f,x,k): b:=kthMomentGF(f,x,2): a/(b^(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? Answer: #[seq(limit(ScaledMomentGF(((1 + x)/2)^n, x, k), n = infinity), k = 2 .. 10)] = 1, 0, 3, 0, 15, 0, 105, 0, 945 #Yes, OEIS is A123023.