Around answer 209140

Definitions

pterm[m_,x_,j_,i_]:=Binomial[x+j,j]Binomial[x-1,j]Binomial[j,i]Binomial[m,i]Binomial[i,m-j]3/((2i-1)(2j+1)(2m-2i-1))

p[m_,x_]:=Sum[pterm[m,x,i,j],{i,0,m},{j,0,m}]

term[m_,k_,i_,j_]=3(-1)^(k+j)Binomial[2k,k]Binomial[j,i]Binomial[m,i]Binomial[i,m-j]/(2(2i-1)(2j+1)(2m-2i-1))

b[k_,x_]=Binomial[x+k,2k]+Binomial[-x+k,2k]

iterm[m_,k_,i_]=((3  Binomial[i,-k+m] Binomial[k,i] Binomial[2 k,k] Binomial[m,i])/((-1+2 i) (-1-2 i+2 m)))

g[m_,k_,i_]=(3 (2^(3+2 k)) m(1-2 i+m) Gamma[(3/2)+k]  Binomial[k+1,i-1]Binomial[m-1,k+1]Binomial[k+1,m-i])/(Gamma[1/2] (1+k)! )

rel1[m_,k_,d_]:=-32 (((3-2 k))^2) (1-k+m) (2-k+m) d[m,-2+k]+4 (1-k+m) ((-3+2 k) (9+8 (-2+k) k)-2 (-1+k) (-9+8 k) m+2 k (m^2)) d[m,-1+k]+k (2-2 k+m) (3-2 k+m) (1-2 k+2 m) d[m,k]

Copy from paper and compare

rel1[m,k,d]==-32(3-2k)^2(-k+m+1)(-k+m+2)d[m,k-2]+4(-k+m+1)(2k m^2-2(k-1)(8k-9)m+(2k-3)(8(k-2)k+9))d[m,k-1]+k(-2k+m+2)(-2k+m+3)(-2k+2m+1)d[m,k]

rel2[m_,k_,d_]:=-4 (-1+(((-1+m))^2)) d[-1+m,-1+k]-4 (1+2 (-1+k)+m) (1-k+m) d[m,-1+k]+k (-2+2 k-m) d[m,k]

Copy from paper and compare

rel2[m,k,d]==-4((m-1)^2-1)d[m-1,k-1]-4(2(k-1)+m+1)(-k+m+1)d[m,k-1]+k(2k-m-2)d[m,k]

longrel[m_,k_,d_]=-64 (((1+2 k))^2) (3+2 k) (k-m)(k-m+1) d[m,k]-8 (3+2 k) (57+24 (k^4)-95 m+42 (m^2)-4 (m^3)-12 (k^3) (-9+4 m)+2 (k^2) (99-83 m+13 (m^2))+k (171-210 m+64 (m^2)-2 (m^3))) d[m,1+k]-(2+k) 2 (48 (k^4)+(k^3) (312-96 m)+8 (k^2) (99-59 m+7 (m^2))+k (924-808 m+192 (m^2)-8 (m^3))-9 (-46+53 m-19 (m^2)+2 (m^3))) d[m,2+k]-(2+k)(3+k) (3+2 k-m) (4+2 k-m) (5-2 (-k+m)) d[m,3+k]

int[m_,k_,d_]=2(2k+1)d[m,k]+(k+1)d[m,k+1]

frac1[m_,k_,i_]=FullSimplify[((6 (((-1))^(2 k)) ((-1+2 k-2 m) (-1+m) m) Binomial[i,1-k+m] Binomial[-1+k,i] Binomial[2 (-1+k),-1+k] Binomial[m,i])/((-1+2 i) (2+4 i-4 m))),Element[k,Integers]&&k>=0]

frac2[m_,k_,i_]=FullSimplify[6 (((-1))^(2 k)) (-1+k-m) Binomial[i,1-k+m] Binomial[-1+k,i] Binomial[2 (-1+k),-1+k] Binomial[m,i],Element[k,Integers]&&k>=0]

catalan[i_]=Binomial[2i,i]/(i+1)

atjumps::usage:="If the elements of oldlist are of a favorable form, atjumps[oldlist,i] finds integers around the jumps of the Floor as a function of i."

atjumps[oldlist_,ii_]:=Module[{newlist,tmp,coefs=Abs[Coefficient[oldlist,ii]]},
tmp=Flatten[Table[Table[ii/.Solve[oldlist[[t]]==j(2n+1),ii],{j,0,coefs[[t]]-1}],{t,Length[oldlist]}]];(* Print["jumps in ",oldlist," at ",tmp]; *)
newlist=FullSimplify[Floor[ii/.ii->tmp],Element[m|n|i,Integers]];If[newlist=={},newlist={0}];Union[newlist-1,newlist,newlist+1]]

ncheck[{numlist_,denomlist_},bound_]:=FullSimplify[Sum[Floor[numlist[[j]]/(2n+1)],{j,Length[numlist]}]-Sum[Floor[denomlist[[j]]/(2n+1)],{j,Length[denomlist]}],Element[n,Integers]&&n≥bound]

numlist={(2 i-2),(2 m),(-2 i+2 m-2)}

denomlist={i,i, (2 i-1),((m-i)),((m-i)),(-1-2 i+2 m)}

numlist2= {i,(-2+2 k), m, (1-2 k+2 m),(-2-2 i+2 m)}

denomlist2={(2i), (-1+k),(-1-i+k),(-1-2 i+2 m),(-2 k+2 m),(-1+i+k-m), (-i+m), (1-k+m)}

numlist3= {(2 k-2), (m-2)}

denomlist3={i, (k-1), (-i+k-1), (m-i), (m-k),(i+k-m-1)}

frac[numlist_,denomlist_]:=Product[numlist[[j]]!,{j,Length[numlist]}]/Product[denomlist[[j]]!,{j,Length[denomlist]}]

test[numlist_,denomlist_,q_]:=Sum[Floor[numlist[[j]]/q],{j,Length[numlist]}]-Sum[Floor[denomlist[[j]]/q],{j,Length[denomlist]}]

flow::usage:="flow[m,k] is d[m,k] evaluated by recursions"

Clear[flow]

flow[0,0]=3/2

flow[1,0]=1

flow[1,1]=-2

flow[x_Integer,y_Integer]:=0/;x<2

flow[x_Integer,y_Integer]:=0/;y<2

flow[0,y_Integer]=0

flow[1,y_Integer]=0

flow[2,y_Integer]:=If[y==2,6,0]

flow[x_Integer,y_Integer]:=0/;(x>2y-2)

flow[x_Integer,y_Integer]:=(flow[x,y]=(-4 (-1+(((-1+x))^2)) flow[-1+x,-1+y]-4 (1+x+2 (-1+y)) (1+x-y) flow[x,-1+y])/(y(2+x-2y)))/;(x<2y-2)

flow[x_,y_]:=((-2+x) (8 (((1-2 y))^2) (-x+y) flow[-1+x,-1+y]+(1+x-2 y) (-1+2 x-2 y) (-1+x+2 y) flow[-1+x,y]))/((1-x) x (1+2 x) (x-y))/;(x==2y-2)

Tables

Table[p[m,x],{m,0,12},{x,-6,6}]//MatrixForm

Table[b[k,x],{k,0,8},{x,-6,6}]//MatrixForm

Table[Sum[term[m,k,i,j],{i,0,m},{j,k,m}],{m,0,10},{k,0,10}]//MatrixForm

Checks

Table[p[m,k],{k,10},{m,2k-1,23}]//Flatten//Union

Table[Binomial[i,j],{i,0,10},{j,i+1,10}]//Flatten//Union

Table[p[m,x]==Sum[flow[m,k]b[k,x],{k,0,m}],{m,-2,14},{x,-4,20}]//Flatten//Union

Table[flow[m,k]==Sum[term[m,k,i,j],{i,0,m},{j,k,m}],{m,0,10},{k,0,10}]//Flatten//Union

FullSimplify[(-1)^j Binomial[x+j,j]Binomial[x-1,j]-(-1)^(j-1)Binomial[x+j-1,j-1]Binomial[x-1,j-1]==(-1)^j Binomial[2j,j]b[j,x]/2,Element[j|x,Integers]]

(-1)^j Binomial[x+j,j]Binomial[x-1,j]-(-1)^(j-1)Binomial[x+j-1,j-1]Binomial[x-1,j-1]==(-1)^j Binomial[2j,j]b[j,x]/2/.j->0

term[m,k,i,j]

Table[Sum[term[m,k,i,j],{i,0,m},{j,k,m}],{k,2,10},{m,2k-2+1,30}]//Flatten//Union

rel2[m+1,k+1,d]

2(2k+1)term[m,k,i,j]+(k+1)term[m,k+1,i,j]

%//FullSimplify

%%/.k->0

%//FullSimplify

Is valid for k > 0. Also for k = -1, k < -1, k = 0.

Table[2(2k+1)flow[m,k]+(k+1)flow[m,k+1]-Sum[iterm[m,k,i],{i,0,m}],{m,0,44},{k,0,m}]//Flatten//Union

Table[Plus@@{-32 (1+2 k) (3+2 k) (k-m) (1+k-m)iterm[m,k,i] ,-4 (1+k-m) (57+110 k+72 (k^2)+16 (k^3)-34 m-46 k m-16 (k^2) m+4 (m^2)+2 k (m^2))iterm[m,k+1,i] ,-(2+k) (5+2 k-2 m) (3+2 k-m) (4+2 k-m)iterm[m,k+2,i],-g[m,k,i+1],+g[m,k,i]},{m,0,55},{k,0,m},{i,0,m}]//Flatten//Union

Plus@@{-32 (1+2 k) (3+2 k) (k-m) (1+k-m)iterm[m,k,i] ,-4 (1+k-m) (57+110 k+72 (k^2)+16 (k^3)-34 m-46 k m-16 (k^2) m+4 (m^2)+2 k (m^2))iterm[m,k+1,i] ,-(2+k) (5+2 k-2 m) (3+2 k-m) (4+2 k-m)iterm[m,k+2,i],-g[m,k,i+1],+g[m,k,i]}

%//FullSimplify

Is valid if i >= 0, k >= 0, m >=  1. Also, if  i < 0 you are left with nothing. So we have now case k >= 0, m >=  1.
If m < 0 then iterm vanishes by definition.

Binomial[i,-k+m] Binomial[k,i] Binomial[2 k,k] Binomial[m,i]- Binomial[i,-1-k+m] Binomial[1+k,i] Binomial[2 (1+k),1+k] Binomial[m,i]+ Binomial[i,-2-k+m] Binomial[2+k,i] Binomial[2 (2+k),2+k] Binomial[m,i]- Binomial[1+k,i]Binomial[1+k,-1-i+m] Binomial[-1+m,1+k]+ Binomial[1+k,-1+i] Binomial[1+k,-i+m] Binomial[-1+m,1+k]

-(1/((-1+2 i) (-1-2 i+2 m)))96 (1+2 k) (3+2 k) (k-m) (1+k-m) Binomial[i,-k+m] Binomial[k,i] Binomial[2 k,k] Binomial[m,i]-(1/((-1+2 i) (-1-2 i+2 m)))12 (1+k-m) (57+110 k+72 (k^2)+16 (k^3)-34 m-46 k m-16 (k^2) m+4 (m^2)+2 k (m^2)) Binomial[i,-1-k+m] Binomial[1+k,i] Binomial[2 (1+k),1+k] Binomial[m,i]+(1/((-1+2 i) (-1-2 i+2 m)))3 (-2-k) (5+2 k-2 m) (3+2 k-m) (4+2 k-m) Binomial[i,-2-k+m] Binomial[2+k,i] Binomial[2 (2+k),2+k] Binomial[m,i]-(1/((Sqrt[π]) (1+k)!))3 (2^(3+2 k)) m (1-2 (1+i)+m) Binomial[1+k,i] Binomial[1+k,-1-i+m] Binomial[-1+m,1+k] Gamma[(3/2)+k]+(1/((Sqrt[π]) (1+k)!))3 (2^(3+2 k)) m (1-2 i+m) Binomial[1+k,-1+i] Binomial[1+k,-i+m] Binomial[-1+m,1+k] Gamma[(3/2)+k]/.m->0

%//FullSimplify

So we also have case m = 0, i >= 0, k>= 0.

FullSimplify[(i≥0&&k≥0&&m≥1)||(i<0)||(m==0&&i≥0&&k≥0),Element[k|i|m,Integers]]

Plus@@{-32 (1+2 k) (3+2 k) (k-m) (1+k-m)iterm[m,k] ,-4 (1+k-m) (57+110 k+72 (k^2)+16 (k^3)-34 m-46 k m-16 (k^2) m+4 (m^2)+2 k (m^2))iterm[m,k+1] ,-(2+k) (5+2 k-2 m) (3+2 k-m) (4+2 k-m)iterm[m,k+2]}/.iterm[m_,k_]->2(2k+1)d[m,k]+(k+1)d[m,k+1]

%==2(3+2k)rel1[m,k+2,d]+(2+k)rel1[m,k+3,d]//FullSimplify

Table[pterm[m,k,i,j],{k,10},{m,2k-1,20},{i,0,m},{j,0,m}]//Flatten//Union

Table[Sum[d[m,k]b[k,1],{k,0,m}]==2d[m,0]+d[m,1],{m,10}]//MatrixForm

Table[Sum[d[m,k]b[k,2],{k,0,m}]==2d[m,0]+4d[m,1]+d[m,2],{m,10}]//MatrixForm

{2d[m,0]+d[m,1],2d[m,0]+4d[m,1]+d[m,2]}/.d[m,2]->-2d[m,0]-4d[m,1]/.d[m,1]->-2d[m,0]

rel1[m,2,d]/.d[m,2]->-2d[m,0]-4d[m,1]/.d[m,1]->-2d[m,0]//FullSimplify

Factor[4 m (1+m-2 (m^2))]

rel1[m,2,d]/.d[m,2]->6d[m,0]/.d[m,1]->-2d[m,0]//FullSimplify

%==4m(m-1)(-2m-1) d[m,0]

%//FullSimplify

FullSimplify[(m>2k-2||m==0||m==1)&&Not[(m>2k-2≥0)||(m==2&&k==0)||(k==0&&m≥3)||m<0||k<0||m==0||m==1],Element[k|i|m,Integers]]

So no case forgotten.

Table[rel1[m,k,flow],{k,-10,3},{m,0,10}]//Flatten//Union

Table[flow[2k-2,k]==p[2k-2,k]==pterm[2k-2,k,k-1,k-1],{k,2,10}]//Flatten//Union

Table[flow[2k-3,k]==p[2k-3,k]==pterm[2k-3,k,k-1,k-1]+pterm[2k-3,k,k-1,k-1],{k,3,10}]//Flatten//Union

Table[flow[2k-2,j],{k,3,10},{j,0,k-1}]//Flatten//Union

Table[flow[2k-3,j],{k,3,10},{j,0,k-1}]//Flatten//Union

rel2[m,k,d]

Table[rel2[m,k,flow],{k,-4,4},{m,-4,12}]//Flatten//Union

Clear[dknown]

dknown[m_,k_]:=0/;(FullSimplify[(m>2k-2)])

dknown[m_,k_]:=pterm[2k-2,k,k-1,k-1]/;(FullSimplify[(m==2k-2)])

dknown[m_,k_]:=pterm[2k-3,k,k-1,k-1]+pterm[2k-3,k,k-1,k-1]/;(FullSimplify[(m==2k-3)])

rel2[2k-3,k,dknown]

FullSimplify[%,Element[k|i|m,Integers]&&k≥4]

This is valid for k not too small.

Table[rel2[2k-3,k,flow],{k,-3,20}]//Flatten//Union

rel2[2k-2,k,dknown]

Table[rel2[2k-2,k,flow],{k,-3,20}]//Flatten//Union

Table[rel2[2k-1,k,dknown],{k,4,17}]//Flatten//Union

Table[rel2[2k-1,k,flow],{k,-3,20}]//Flatten//Union

Table[rel2[2k,k,dknown],{k,4,17}]//Flatten//Union

Table[rel2[2k,k,flow],{k,-3,20}]//Flatten//Union

(-7+2k)rel2[2k-4,k,d]-rel1[2k-4,k,d]//FullSimplify

%/.d->dknown

%//FullSimplify

Table[rel2[m,k,flow],{k,-4,2},{m,-4,8}]//Flatten//Union

rel2[m,k,d]

rel1[m,k,d]

(-1+k) (-1+2 k-2 m) (-3+2 k-m)(4-2 k+m)rel2[m,k,d]+4 (-1+(-1+m)^2)rel1[m-1,k-1,d]-32 (5-2 k)^2 (-2+k-m) (-1+k-m)rel2[m,k-2,d]+4 (1-k+m) (-99+16 k^3-2 m (32+m)-8 k^2 (11+2 m)+2 k (81+m (31+m)))rel2[m,k-1,d]-(-1+k) (-4+2 k-m)rel1[m,k,d]-4 (-1+k-m) (-5+2 k+m)rel1[m,k-1,d]//FullSimplify

int[m,k,d]

-rel1[m,k,d]+2(m−1)m(2m+1)d[m,k-1]+(2−2k+m)(3−2k+m)(1−2k+2m)int[m,k-1,d]+16(3−2k)(−2+k−m)(−1+k−m)int[m,k-2,d]//FullSimplify

frac1[m,k,i]==3(m-1)m Binomial[2k-2,k-1](-2k+2m+1)Binomial[k-1,i]Binomial[m,i]Binomial[i,-k+m+1]/((2i-1)(2m-2i-1))//FullSimplify

frac2[m,k,i]

iterm[m,k-1,i]

iterm[m,k-2,i]

frac1[m,k,i]+frac2[m,k,i]==(2−2k+m)(3−2k+m)(1−2k+2m)iterm[m,k-1,i]+16(3−2k)(−2+k−m)(−1+k−m)iterm[m,k-2,i]//FullSimplify

Is valid if i >= 0, k >= 2, m >=  0. Also if i < 0. 
frac1[m,k,i] is nonzero only if m >= k-1 >= i >= m-k+1 >= 0
frac2[m,k,i]  is nonzero only if m >= k-1  >= i >= m-k+1 > 0
iterm[m,k-1,i] is nonzero only if m >= k-1  >= i >= m-k+1 >= 0
iterm[m,k-2,i] is nonzero only if m >= k-2  >= i >= m-k+2 >= 0.
So we may assume m >= k-2,  k-1  >= i >= m-k+1, i >= 0, k >= 1, m >= 0.
We still need the case i >= 0, k = 1, m >= 0.

frac1[m,1,i]+frac2[m,1,i]

(2−2k+m)(3−2k+m)(1−2k+2m)iterm[m,k-1,i]+16(3−2k)(−2+k−m)(−1+k−m)iterm[m,k-2,i]/.k->1

%==%%/.i->0

%/.m->0

frac1[k-1,k,i]/(6m(m-1))/.m->k-1/.i->k-1//FullSimplify

%==catalan[k-2]//FullSimplify

frac1[k-1,k,i]/(6m(m-1))/.m->k-1/.i->0//FullSimplify

%==catalan[k-2]//FullSimplify

-frac[numlist,denomlist]/2

frac1[m,m+1,i]/(6m(m-1))

%==%%//FullSimplify

test[numlist,denomlist,2n+1]

Table[test[numlist,denomlist,2n+1],{n,9},{m,2n+1},{i,2n+1}]//Flatten//Union

Length[ivals=atjumps[Union[numlist,denomlist],i]]

Table[pairlist2={numlist,denomlist}/.i->ivals[[y]];mvals=atjumps[Union@@pairlist2,m];
Table[ ncheck[pairlist2/.m->mvals[[x]],5],{x,Length[mvals]}],{y,Length[ivals]}]

tmp=%//Flatten;{Length[tmp],Union[tmp]}

frac1[m,k,i]/(6m(m-1)catalan[i-1])//FullSimplify

frac[numlist2,denomlist2]

%==%%//FullSimplify

test[numlist2,denomlist2,2n+1]

Table[test[numlist2,denomlist2,2n+1],{n,9},{k,2n+1},{m,2n+1},{i,2n+1}]//Flatten//Union

Length[kvals2=atjumps[Union[numlist2,denomlist2],k]]

kvals=atjumps[Union[numlist2,denomlist2],k]

Table[pair1={numlist2,denomlist2}/.k->kvals[[z]];mvals=atjumps[Union@@pair1,m];Table[pair2=pair1/.m->mvals[[y]];ivals=atjumps[Union@@pair2,i];
Table[ ncheck[pair2/.i->ivals[[x]],6],{x,Length[ivals]}],{y,Length[mvals]}],{z,Length[kvals]}]

tmp=%//Flatten;{Length[tmp],Union[tmp]}

frac2[m,k,i]/(6m(m-1))

frac[numlist3,denomlist3]

-%==%%//FullSimplify

test[numlist3,denomlist3,2n+1]

Table[test[numlist3,denomlist3,2n+1],{n,9},{k,2n+1},{m,2n+1},{i,2n+1}]//Flatten//Union

Length[kvals2=atjumps[Union[numlist3,denomlist3],k]]

kvals=atjumps[Union[numlist3,denomlist3],k]

Table[pair1={numlist3,denomlist3}/.k->kvals[[z]];mvals=atjumps[Union@@pair1,m];Table[pair2=pair1/.m->mvals[[y]];ivals=atjumps[Union@@pair2,i];
Table[ ncheck[pair2/.i->ivals[[x]],6],{x,Length[ivals]}],{y,Length[mvals]}],{z,Length[kvals]}]

tmp=%//Flatten;{Length[tmp],Union[tmp]}