#C27.txt: Maple code for Lecture 27 of "Experimental Mathematics #taught by Dr. Z., April 29, 2021 Help27:=proc(): print(`SAc(f,x,K), ScM(f,x,K), pn(n), Seqpn(n), pnt(n,t), Seqpn(n,t), GMN(M,N) `): end: #From Victoria Chayes' hw9 SAc:=proc(f,x,K) local f1,L,mu,i: if subs(x=1,f)=0 then RETURN(FAIL): fi: f1:=f/subs(x=1,f): mu:=subs(x=1,x*diff(f1,x)): f1:=f1/x^mu: L:=[]: for i from 1 to K do f1:=x*diff(f1,x): L:=[op(L), subs(x=1,f1)]: od: [mu,op(2..K,L)]: end: #end from Victoria Chayes hw9 #ScM(f,x,K): The expectation, variance, and #scaled moments about the mean (up to the K-th #moment) of the r.v. whose #prob. generating function is f in the variable x #Try: #ScM((1+x)^1000,x,4); ScM:=proc(f,x,K) local L,sd: if K<=2 then RETURN(FAIL): fi: L:=SAc(f,x,K): if L=FAIL then RETURN(FAIL): fi: if L[2]=0 then RETURN(L): fi: sd:=sqrt(L[2]): [L[1],L[2],seq(L[i]/sd^i,i=3..K)]: end: #From C11.txt #pnk(n,k): pnk:=proc(n,k) local k1: option remember: if not (type(n,integer) and type(k,integer) and n>=1 and k>=1 )then RETURN(0): fi: if n=k then RETURN(1): else RETURN(add(pnk(n-k,k1),k1=1..min(k,n-k))): fi: end: pn:=proc(n) local k: option remember: if n=0 then RETURN(1): fi: add(pnk(n,k),k=1..n): end: Seqpn:=proc(N) local n: [seq(pn(n),n=1..N)]: end: #end from C11.txt #GMNk(M,N,k): The list in lex. order of the #integer partions of k that fit in an M by N rectangle #(largest part is<=M, number of parts <=N) GMNk:=proc(M,N,k) local S, S1,i: option remember: if M=0 or N=0 then if k=0 then RETURN([[]]): else RETURN([]): fi: fi: if k<0 then RETURN([]): fi: if k=0 then RETURN([[]]): fi: S:=GMNk(M-1,N,k): S1:=GMNk(M,N-1,k-M): S:=[op(S), seq([M,op(S1[i])],i=1..nops(S1))]: S: end: #GMN(M,N): The Gaussian Lattice GMN:=proc(M,N) local k: [seq(GMNk(M,N,k),k=0..M*N)]: end: