###################################################################### ## AreaBounce.txt: Save this file as AreaBounce.txt to use it, # # stay in the # ## same directory, get into Maple (by typing: maple ) # #then type: read `AreaBounce.txt`: # ## Then follow the instructions given there # ## # ## Written by AJ Bu and Doron Zeilberger, Rutgers University , # ## DoronZeil@gmail.com . # ###################################################################### with(combinat): Digits:=100: print(`First Written: July 2022: tested for Maple 20 `): print(): print(`This is AreaBounce.txt, A Maple package`): print(`accompanying AJ Bu and Doron Zeilberger's article: `): print(` Experimenting with the Area Statistics of Generalized Dyck Paths`): print(`-------------------------------`): print(`-------------------------------`): print(): print(`The most current version is available on WWW at:`): print(` http://www.math.rutgers.edu/~zeilberg/tokhniot/AreaBounce.txt .`): print(`Please report all bugs to: DoronZeil at gmail dot com .`): print(): print(`-------------------------------`): print(`For general help, and a list of the MAIN functions,`): print(` type "ezra();". For specific help type "ezra(procedure_name);" `): print(`-------------------------------`): print(`For a list of the supporting functions type: ezra1();`): print(`For help with a specific procedure, type "ezra(procedure_name);"`): print(): print(`-------------------------------`): ezra1:=proc() if args=NULL then print(` The supporting procedures are: `): print(`area, bounce, DPn, DPnk, qbin `): else ezra(args): fi: end: ezra:=proc() if args=NULL then print(` AreaBounce.txt: A Maple package for experimenting with the Area and Bounce Statistics on Dyck Paths`): print(`The main procedures are : CheckSym, CheckSymF, Fn, Fnk, Gn, Gnk, Thm34`): elif nargs=1 and args[1]=area then print(`area(P): The area of the Dyck Path P, try: `): print(` area([1,1,1,-1,-1,-1]);`): elif nargs=1 and args[1]=bounce then print(` bounce(P): The bounce statistic of the Dyck Path P, try: `): print(` bounce([1,1,1,-1,-1,-1]);`): elif nargs=1 and args[1]=CheckSym then print(`CheckSym(n): Checks that Fn(n,q,t)=Fn(n,t,q). Try:`): print(`CheckSym(5);`): elif nargs=1 and args[1]=CheckSymF then print(`CheckSymF(n): Checks that Gn(n,q,t)=Gn(n,t,q). Same output as CheckSym(n), but faster. Try:`): print(`CheckSymF(5);`): elif nargs=1 and args[1]=DPnk then print(`DPnk(n,k): The set of Dyck-paths of semi-length n that start with k 1's. Try:`): print(` DPnk(5);`): elif nargs=1 and args[1]=DPn then print(`DPn(n): The set of Dyck-paths of semi-length n. Try:`): print(` DPn(5);`): elif nargs=1 and args[1]=Fn then print(`Fn(n,q,t): The weight-enumertor of all Dyck-paths of semi-length n according to the weight q^area(P)*t^bounce(P), In other words the weight-enumerator of DPn(n). It is done directly. Try:`): print(`Fn(5,q,t);`): elif nargs=1 and args[1]=Fnk then print(`Fnk(n,k,q,t): The weight-enumertor of all Dyck-paths of semi-length n that start with k 1's, according to the weight q^area(P)*t^bounce(P), In other words the weight-enumerator of DPnk(n,k). It is done directly. Try:`): print(`Fn(5,q,t);`): elif nargs=1 and args[1]=Gn then print(`Gn(n,q,t): The weight-enumertor of all Dyck-paths of semi-length n according to the weight q^area(P)*t^bounce(P), In other words the weight-enumerator of DPn(n). Done via the recurrence of Haglund's theorem. `): print(` Same output as Fn(n,q,t), but faster. Try:`): print(`Gn(5,q,t);`): elif nargs=1 and args[1]=Fnk then print(`Fnk(n,k,q,t): The weight-enumertor of all Dyck-paths of semi-length n that start with k 1's, according to the weight q^area(P)*t^bounce(P), In other words the weight-enumerator of DPnk(n,k). It is done directly. Try:`): print(`Fn(5,q,t);`): elif nargs=1 and args[1]=Gnk then print(`Gnk(n,k,q,t): The weight-enumertor of all Dyck-paths of semi-length n that start with k 1's, according to the weight q^area(P)*t^bounce(P), In other words the weight-enumerator of DPnk(n,k). Done via the recurrence of Haglund's theorem. `): print(` Same output as Fnk(n,k,q,t), but faster. Try:`): print(`Gnk(5,3,q,t);`): elif nargs=1 and args[1]=qbin then print(`qbin(q,a,b): The q-binomial coefficient (1-q^a)*...(1-q^(a-b+1))/((1-q)*...*(1-q^b)). Try: `): print(`qbin(q,5,3);`): elif nargs=1 and args[1]=Thm34 then print(`Thm34(n,k): verifies empirically Haglund's Theorem 3.4. Try: `): print(`Thm34(5,4);`): print(``): else print(`There is no such thing as`, args): fi: end: Help:=proc(): print(`BouncePath(P), NorthPath(P), bounceInfo(P), Agf(n,t),qbin(q,a,b)`): print(`Thm34(n,k)`): end: BouncePath:=proc(P) local n,height,L,pi1,heightB,co,i,c: n:=nops(P)/2: L:=[]: height:=0: heightB:=0: pi1:=subs({-1=0},P): while heightB0 or pi1[i]=1) do co:=co+1: if pi1[i]=0 then c:=c-1: fi: od: fi: L:=[op(L),1$co,(-1)$co]: height:=height+add(pi1[i],i=2*heightB+1..min(2*heightB+2*co,2*n)): heightB:=heightB+co: od: L: end: #NorthPath(P): inputs a path P, and removes up to the end of the first North run and also outputs #the length of the first North run NorthPath:=proc(P) local n,pi1,co,i: n:=nops(P): pi1:=P: while pi1[1]=-1 do pi1:=[op(2..nops(pi1),pi1)]: od: co:=0: for i from 1 while pi1[i]=1 do co:=co+1: od: [op(co+1..nops(pi1),pi1)],co: end: #bounceInfo(P): Inputs a Dyck path P #outputs the bounce, the number of bounces, the length of each bounce, and the peaks bounceInfo:=proc(P) local n,height,pi1,NP,lengths,peaks,P1,i: P1:=BouncePath(P): n:=nops(P1)/2: pi1:=P1: height:=[0]: lengths:=[]: peaks:=[]: while height[-1]<>n do NP:=NorthPath(pi1): pi1:=NP[1]: height:=[op(height),height[-1]+NP[2]]: lengths:=[op(lengths),NP[2]]: peaks:=[op(peaks), [height[-2],height[-1]]]: od: add(n-height[i],i=2..nops(height)-1), nops(height)-1,lengths,peaks: end: #bounce(P): Inputs a Dyck path P #outputs the bounce bounce:=proc(P) local n,height,pi1,NP,P1,i: P1:=BouncePath(P): n:=nops(P1)/2: pi1:=P1: height:=[0]: while height[-1]<>n do NP:=NorthPath(pi1): pi1:=NP[1]: height:=[op(height),height[-1]+NP[2]]: od: add(n-height[i],i=2..nops(height)-1): end: #area(P): inputs a Dyck path P #outputs the area area:=proc(P) local n,width,pi1,height,area,NP,i: n:=nops(P)/2: width:=0: pi1:=P: height:=0: area:=0: while height