#C21.txt Help:=proc(): print(`GR1(DS,d1,d2,n), GR(DS,n), GRm(DS,k,n) , BW2(a,b), BW2a(m1,m2) `): print(`GuessBW2(a,b), GuessAndProveBW2(a,b), GuessBW3(a,b,c) `): end: #The number of Young Tableaux of shape [a,b] (or walks from [0,0] to [a,b] always staying in #x>=y BW2:=proc(a,b) option remember: if a<0 or b<0 or b-a>=1 then 0: elif a=0 and b=0 then 1: else BW2(a-1,b)+BW2(a,b-1): fi: end: BW2a:=proc(m1,m2): BW2(m1+m2,m2)/binomial(m1+2*m2,m2):end: #GuessBW2(a,b): guesses a closed-form formula (from scratch) for the number of Young tableaux #of shape [a,b] GuessBW2:=proc(a,b) local i,j,DS,n,f: DS:={seq(seq([ [i,j], BW2a(i,j)] , i=0..6),j=0..6)}: f:=GRm(DS,2,n): if f=FAIL then RETURN(FAIL): fi: #a=n[1]+n[2], b=n[2] subs({n[2]=b,n[1]=a-b},f)*(a+b)!/a!/b!: end: #GuessAndProveBW2(a,b): guesses a closed-form formula (from scratch) for the number of Young tableaux #of shape [a,b] GuessAndProveBW2:=proc(a,b) local i,j,DS,n,f: DS:={seq(seq([ [i,j], BW2a(i,j)] , i=0..6),j=0..6)}: f:=GRm(DS,2,n): if f=FAIL then RETURN(FAIL): fi: #a=n[1]+n[2], b=n[2] f:=subs({n[2]=b,n[1]=a-b},f)*(a+b)!/a!/b!: f,evalb(subs(b=a+1,f)=0 and normal(1-simplify(subs(a=a-1,f)/f)-simplify(subs(b=b-1,f)/f))=0): end: #The number of Young Tableaux of shape [a,b,c] (or walks from [0,0,0] to [a,b,c] always staying in #x>=y>=z>=0 BW3:=proc(a,b,c) option remember: if a<0 or b<0 or c<0 or b-a=1 or c-b=1 then 0: elif a=0 and b=0 and c=0 then 1: else BW3(a-1,b,c)+BW3(a,b-1,c)+BW3(a,b,c-1): fi: end: BW3a:=proc(m1,m2,m3): BW3(m1+m2+m3,m2+m3,m3)/((m1+m2+m3+(m2+m3)+m3)!/((m1+m2+m3)!*(m2+m3)!*m3!)):end: #GuessBW3(a,b,c): guesses a closed-form formula (from scratch) for the number of Young tableaux #of shape [a,b,c] GuessBW3:=proc(a,b,c) local i,j,DS,n,f: DS:={seq(seq(seq([ [i,j,k], BW3a(i,j,k)] , i=0..8),j=0..8),k=0..8)}: f:=GRm(DS,3,n): if f=FAIL then RETURN(FAIL): fi: #a=n[1]+n[2]+n[3], b=n[2]+n[3],c=n[3] subs({n[3]=c,n[2]=b-c,n[1]=a-b},f)*(a+b+c)!/a!/b!/c!: end: #GuessAndProveBW3(a,b,c): guesses a closed-form formula (from scratch) for the number of Young tableaux #of shape [a,b,c] GuessAndProveBW3:=proc(a,b,c) local i,j,DS,n,f: DS:={seq(seq(seq([ [i,j,k], BW3a(i,j,k)] , i=0..8),j=0..8),k=0..8)}: f:=GRm(DS,3,n): if f=FAIL then RETURN(FAIL): fi: #a=n[1]+n[2]+n[3], b=n[2]+n[3],c=n[3] f:=subs({n[3]=c,n[2]=b-c,n[1]=a-b},f)*(a+b+c)!/a!/b!/c!: f,evalb(subs(b=a+1,f)=0 and subs(c=b+1,f)=0 and normal(1-simplify(subs(a=a-1,f)/f)-simplify(subs(b=b-1,f)/f) - simplify(subs(c=c-1,f)/f ))=0): end: ###Start Guess a rational function #GR1(DS,d1,d2,n): guesses a rational function in n with top degree d1 and bottom degree d2 #for the data set DS {[a,b]} GR1:=proc(DS,d1,d2,n) local a,b,T,B,R,eq,var,i: if nops(DS)<=d1+d2+3 then RETURN(FAIL): fi: T:=add(a[i]*n^i,i=0..d1): B:=add(b[i]*n^i,i=0..d2-1)+n^d2: R:=T/B: var:={seq(a[i],i=0..d1),seq(b[i],i=0..d2-1)}: eq:={seq(numer( subs(n=DS[i][1],R)-DS[i][2]),i=1..nops(DS))}: var:=solve(eq,var): if var=NULL then RETURN(FAIL): else factor(subs(var,R)): fi: end: #GR(DS,n): guesses a rational function #for the data set DS {[a,b]} GR:=proc(DS,n) local d1,d2,hope: for d1 from 0 to nops(DS)-4 do for d2 from 0 to nops(DS)-d1-4 do hope:=GR1(DS,d1,d2,n): if hope<>FAIL then RETURN(hope): fi: od: od: FAIL: end: ##end Guess a rational function #GRm(DS,k,n): inputs a st of data [pt,Value] guesses a rational function in n[1], ..., n[k] GRm:=proc(DS,k,n) local ds,DS1,LC,a,FD,hope: if {seq(nops(ds[1]),ds in DS)}<>{k} then RETURN(FAIL): fi: if k=1 then RETURN(GR({seq([ds[1][1],ds[2]], ds in DS)},n[1])): fi: LC:={seq(ds[1][k],ds in DS)}: for a in LC do DS1[a]:={}: od: for ds in DS do DS1[ds[1][k]]:=DS1[ds[1][k]] union {[[op(1..k-1,ds[1])],ds[2]]}: od: FD:={}: for a in LC do hope:=GRm(DS1[a],k-1,n): if hope=FAIL then RETURN(FAIL): else FD:=FD union {[a,hope]}: fi: od: GR(FD,n[k]): end: #end guessing