############################################################# ##DR ## To use it, stay in the ##same directory, get into Maple (by typing: maple ) ##and then type: read HIRSCH ##Then follow the instructions given there ## ##Written by Ha Luu and Doron Zeilberger, Rutgers University ############################################################## print(` This is DR `): print(`Written by Ha Luu and Doron Zeilberger `): print(``): print(`---------------------------------------`): print(`For a list of the MAIN procedures type Help();, for help with`): print(`a specific procedure, type HelpWith(procedure_name); .`): print(``): print(`---------------------------------------`): with(combinat): Digits:=100: Help:=proc() if args=NULL then print(`The procedures are :ID, NumLr,NumLrs, GPLP, GFLPf,GFLPhi,LarPNumsP,NumPLr`): print(``): else HelpWith(args): fi: end: HelpWith:=proc() if args=NULL then print(`The procedures are: ID, NumLr,NumLrs, GPLP, GFLPf,GFLPhi,LarPNumsP,NumPLr `): print(``): elif nops([args])=1 and op(1,[args])=ID then print(`ID(f,x,k): Given the probabity generating function f`): print(`in the variable x, for some r.v. under some prob. distibution`): print(`outputs the list [av,var, std. moms].Try`): print(`ID((1+x)^10,x,4);`): elif nops([args])=1 and op(1,[args])=NumLr then print(`NumLr(n,k): give a number n, find the total number of`): print(`ways to partition n such that the largest part is k.Try`): print(`NumLr(7,4);`): elif nops([args])=1 and op(1,[args])=GFLP then print(`GFLP(k,t): the first k terms in the sequence of polynomials`): print(`P_i(t):= Sum of t^(largest part(partition)), over all partitions`): print(`of the integer i.Using the generating function, and taylor.Try:`): print(`GFLP(10,t);`): elif nops([args])=1 and op(1,[args])=NumLrs then print(`NumLrs(n): give a number n, out put list of numbers such that`): print(`the i-th entry is the number of way to partition n , with i`): print(`to be the largest part.Try:`): print(`NumLrs(100);`): elif nops([args])=1 and op(1,[args])=GFLPf then print(`GFLPf(k,t): the first k terms in the sequence of polynomials`): print(`P_i(t):= Sum of t^(largest part(partition)), over all partitions of`): print(`the integer i using the recurrence for A(n,k):=number of partitions `): print(`of n with largest part k. Try:`): print(`GFLPf(10,t);`): elif nops([args])=1 and op(1,[args])=GFLPhi then print(`GFLPhi(k,t,s): the first k terms in the sequence of polynomials`): print(`P_n(t,s):=sum of s^(largest part)*t^(hirsch index), over all`): print(`partition of the integer n, using the generating function and taylor.Try`): print(`Try GFLPhi(10,t,1);`): elif nops([args])=1 and op(1,[args])=LarPNumsP then print(`LarPNumsP(n,p,q): is the number of partition n such that`): print(`the largest part is p and there is <=q parts by using recurrence function.Try:`): print(`LarPNumsP(8,5,3)`): elif nops([args])=1 and op(1,[args])=NumPLr then print(`NumPLr(n,k,s): Given a number n, output A(n,k,s) such that`): print(`A(n,k,s) is total number of ways to partition n, with the largest`): print(`part is k, and size of Durfee rectangle is s,using the recurrence equation.Try`): print(`NumPLr(8,3,2)`): elif nops([args])=1 and op(1,[args])=ID2 then print(`ID2(f,x,y,k): Given the probabity generating function f`): print(`in the variable x,y for some r.v. under some prob. distibution`): print(`outputs the list [av,var, std. moms].Try:`): print(`ID(x^2+3*y^3,x,y,3)`): fi: end: ############################################################## # #ID(f,x,k): Given the probabity generating function f #in the variable x, for some r.v. under some prob. distibution #outputs the list [av,var, std. moms] ID:=proc(e,x,k) local i,av,M, f: f:=e/subs(x=1,e): av:=subs(x=1,diff(f,x)): M:=[av]: f:=f/x^av: f:=x*diff(f,x): for i from 2 to k do f:=x*diff(f,x): M:=[op(M),subs(x=1,f)]: od: M: normal([M[1],M[2],seq(M[i]/M[2]^(i/2),i=3..k)]): end: ################################################################ #NumLr(n,k): Given a number n, output A(n,k) such that #A(n,k) is total number of ways to partition n, with the largest #part is k, using the recurrence equation. NumLr:=proc(n,k) local i: option remember; if n<0 then return 0: elif n=k then return 1: else return add(NumLr(n-k,i),i=1..k): fi: end: ############################################################## #NumLrs(n): give a number n, out put list of numbers such that #the i-th entry is the number of way to partition n , with i #to be the largest part. NumLrs:=proc(n) local i: [seq(NumLr(n,i),i=1..n)]: end: ################################################################### #GFLP(k,t): the first k terms in the sequence of polynomials #P_i(t):= Sum of t^(largest part(partition)), over all partitions of the integer i #Using the generating function, and taylor GFLP:=proc(k,t) local i,lu,q: lu:=expand(taylor(mul(1/(1-q^i*t),i=1..k),q=0,k+2)): [seq(coeff(lu,q,i),i=1...k)]: end: #GFLPf(k,t): the first k terms in the sequence of polynomials #P_i(t):= Sum of t^(largest part(partition)), over all partitions of the integer i #Using the recurrence for A(n,k):=number of partitions of n with largest part k GFLPf:=proc(k,t) local i,n: option remember: [seq(add(NumLr(n,i)*t^i,i=1..n),n=1..k)]: end: #####################################################################-new stuffs ##################################################################### #GFLPhi(k,t,s): the first k terms in the sequence of polynomials #P_n(t,s):=sum of s^(largest part)*t^(hirsch index), over all #partition of the integer n, using the generating function and taylor GFLPhi:=proc(k,t,s) local i, n, q, lu : lu:=add(q^(n^2)*t^n*s^n/mul((1-q^i),i=1..n)/mul(1-q^i*s,i=1..n),n=1..k): lu:=expand(taylor(lu,q=0,k^2+1)): [seq(coeff(lu,q,j),j=1..k^2)]: end: #################################################################### #################################################################### #LarPNumsP(n,p,q): is the number of partition n such that #the largest part is p and there is <=q part #by using recurrence function. ##A(8,3,2)=A(5,1,1)+A(5,2,1)+A(5,3,1) LarPNumsP:=proc(n,p,q) local i,j: option remember: if n<0 then return 0: elif q>n then return 0: elif n=p and q=1 then return 1: elif n