#Ok to post homework #Tifany Tong, October 18th, 2020, HW #12 # Question 1 CPg := proc(L) local i, curr: curr := CP(L[1], L[2]): for i from 3 to nops(L) do curr := CP(curr, L[i]): od: return curr: end: # Question 2 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 to k do f1 := expand(x*diff(f1, x)): od: subs(x = 1, f1): end: # Question 3 ScaledMomentGF := proc(f, x, k) local a, b, c: a := kthMomentGF(f, x, k): b := kthMomentGF(f, x, 2): b := b^(k/2): return a/b: end: # Question 4 # 1, 0, 3, 0, 15, 0, 105, 0, 945 --> I get A123023 in the OEIS.