#M1.txt: Maple Code for Lecture 1 of Math 454,Combinatorics, Rutgers University, taught by Dr. Z. (Doron Zeilberger) Help1:=proc():print(`Walks(m,n), NuWalks(m,n) `): end: #Walks(m,n): inputs two non-negative integers m and n #and outputs the SET of all walks {E,N} from [0,0] to [m,n] #all the rearramgemets of E^m N^n [ Added 9/10/20: Correcting a typo noticed by Jehan Abdul-Jabbar] Walks:=proc(m,n) local W1,W2,w1,w2: option remember: if m<0 or n<0 then RETURN({}): fi: if m=0 and n=0 then RETURN({[]}): fi: W1:=Walks(m-1,n): W2:=Walks(m,n-1): {seq([op(w1),E],w1 in W1), seq([op(w2),N],w2 in W2) }: end: #NuWalks(m,n): inputs two non-negative integers m and n #and outputs the SET of all walks {E,N} from [0,0] to [m,n] #all the rearramgemets of E^nN^m NuWalks:=proc(m,n) local W1,W2,w1,w2: option remember: if m<0 or n<0 then RETURN(0): fi: if m=0 and n=0 then RETURN(1): fi: W1:=NuWalks(m-1,n): W2:=NuWalks(m,n-1): W1+W2: end: