zeilberg.tst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. % Tests of the ZEILBERG package.
  2. % Authors: Gregor Stoelting, Wolfram Koepf (koepf@zib-berlin.de)
  3. load_package sum;
  4. % on time;
  5. % 1) Successful summations by the Gosper algorithm
  6. % R. W. Gosper, Jr.:
  7. % Decision procedure for indefinite hypergeometric summation,
  8. % Proc. Nat. Acad. Sci. USA 75 (1978), 40-42.
  9. gosper(k,k);
  10. gosper(k^2,k);
  11. gosper(k^3,k);
  12. gosper(k^4,k);
  13. gosper(k^5,k);
  14. % gosper(k^20,k);
  15. gosper((6*k+3)/(4*k^4+8*k^3+8*k^2+4*k+3),k);
  16. % gosper(2^k*(k^3-3*k^2-3*k-1)/(k^3*(k+1)^3),k);
  17. gosper(x*k,k);
  18. gosper(k*x^k,k);
  19. gosper(k*factorial(k),k);
  20. gosper(1/(k^2-1),k);
  21. gosper((1+2*k)/((1+k^2)*(k^2+2*k+2)),k);
  22. gosper((k^2+4*k+1)*factorial(k),k);
  23. gosper((4*k-3)*factorial(2*k-2)/factorial(k-1),k);
  24. gosper(gamma(k+n+2)*n/((k+n+1)*gamma(k+2)*gamma(n+1)),k);
  25. gosper((k+n)*factorial(k+n),k);
  26. gosper((3*(1+2*k))/((1+k^2)*(2+2*k+k^2)),k);
  27. % gosper((-25+15*k+18*k^2-2*k^3-k^4)/
  28. % (-23+479*k+613*k^2+137*k^3+53*k^4+5*k^5+k^6),k);
  29. % gosper(3^k*(2*k^4+4*k^3-7*k^2-k-4)/(k*(k+1)*(k^2+1)*((k+1)^2+1)),k);
  30. gosper(3^k*(4*k^2-2*k-3)/((2*k+3)*(2*k+1)*(k+1)*k),k);
  31. % gosper(2^k*(2*k^3+3*k^2-20*k-15)/
  32. % ((2*k+3)*(2*k+1)*(k+5)*(k+4)*(k+1)*k),k);
  33. % gosper(-2^k*((k+11)^2*(k+1)^2-2*(k+10)^2*k^2)/
  34. % ((k+11)^2*(k+10)^2*(k+1)^2*k^2),k);
  35. % gosper(-2^k*((k+6)^2*(k+1)^2-2*(k+5)^2*k^2)/
  36. % ((k+6)^2*(k+5)^2*(k+1)^2*k^2),k);
  37. % gosper(2^k*(k^4-14*k^2-24*k-9)/(k^2*(k+1)^2*(k+2)^2*(k+3)^2),k);
  38. % gosper(((k^2-k-n^2-n-2)*gamma(k+n+2)*gamma(n+1))/
  39. % (2*(-1)^k*2^k*(k+n+1)*gamma(-(k-n-1))*gamma(k+2)),k);
  40. % gosper(1/(k+1)*binomial(2*k,k)/(n-k+1)*binomial(2*n-2*k,n-k),k);
  41. gosper(3^k*(4*k^2+2*a*k-4*k-2-a)/((2*k+2+a)*(2*k+a)*(k+1)*k),k);
  42. gosper(2^k*(k^2-2*k-1)/(k^2*(k+1)^2),k);
  43. gosper((3*k^2+3*k+1)/(k^3*(k+1)^3),k);
  44. gosper((6*k+3)/(4*k^4+8*k^3+8*k^2+4*k+3),k);
  45. gosper(-(k^2+3*k+3)/(k^4+2*k^3-3*k^2-4*k+2),k);
  46. gosper(k^2*4^k/((k+1)*(k+2)),k);
  47. gosper((2*k-1)^3,k);
  48. gosper(3*k^2+3*k+1,k);
  49. gosper((k^2+4*k+2)*2^k,k);
  50. % gosper(2^k*(k^3-3*k^2-3*k-1)/(k^3*(k+1)^3),k);
  51. gosper(k*n^k,k);
  52. % gosper(3^k*(2*k^3+k^2+3*k+6)/((k^2+2)*(k^2+2*k+3)),k);
  53. % gosper(4*(1-k)*(k^2-2*k-1)/(k^2*(k+1)^2*(k-2)^2*(k-3)^2),k);
  54. % gosper(2^k*(k^4-14*k^2-24*k-9)/(k^2*(k+1)^2*(k+2)^2*(k+3)^2),k);
  55. gosper((1+k)/(1-k)+2/k,k);
  56. gosper(1/(k*(k+1)),k);
  57. gosper(1/(k*(k+2)),k);
  58. gosper(1/(k*(k+10)),k);
  59. % gosper(1/(k*(k+30)),k);
  60. gosper(1/(k*(k+1)*(k+2)),k);
  61. gosper(1/(k*(k+1)*(k+2)*(k+3)*(k+4)*(k+5)*(k+6)*(k+7)*(k+8)*(k+9)*
  62. (k+10)),k);
  63. gosper(pochhammer(k-n,n),k);
  64. gosper((a+k-1)*pochhammer(a,k),k);
  65. gosper((a-k-1)/pochhammer(a-k,k),k);
  66. gosper(binomial(k,n),k);
  67. gosper(k*binomial(k,n),k);
  68. % gosper(k^10*binomial(k,n),k);
  69. gosper(1/binomial(k,n),k);
  70. gosper(k/binomial(k,n),k);
  71. % gosper(k^10/binomial(k,n),k);
  72. gosper(binomial(k-n,k),k);
  73. gosper((-1)^k*binomial(n,k),k);
  74. gosper((-1)^k/binomial(n,k),k);
  75. gosper((-1)^(k+1)*(4*k+1)*factorial(2*k)/
  76. (factorial(k)*4^k*(2*k-1)*factorial(k+1)),k);
  77. % term:=3^k*(3*k^2+2*a*k-4*k-2-a)/((2*k+2+a)*(2*k+a)*(k+1)*k)$
  78. % term:=sub(k=k+3,term)-term$
  79. % gosper(term,k);
  80. % clear(term);
  81. % 2) Examples for the Wilf-Zeilberger method:
  82. % H. S. Wilf and D. Zeilberger:
  83. % Rational functions certify combinatorial identities.
  84. % J. Amer. Math. Soc. 3, 1990, 147-158.
  85. % Binomial theorem
  86. summand:=binomial(n,k)/2^n$
  87. gosper(sub(n=n+1,summand)-summand,k);
  88. % Vandermonde
  89. summand:=binomial(n,k)^2/binomial(2*n,n)$
  90. gosper(sub(n=n+1,summand)-summand,k);
  91. % Gauss
  92. % summand:=factorial(n+k)*factorial(b+k)*factorial(c-n-1)*factorial(c-b-1)
  93. % /(factorial(n-1)*factorial(c-n-b-1)*factorial(k+1)*factorial(c+k)*
  94. % factorial(b-1))$
  95. % gosper(sub(n=n+1,summand)-summand,k);
  96. % Kummer
  97. % summand:=(-1)^(n+k)*factorial(2*n+c-1)*factorial(n)*factorial(n+c-1)/(
  98. % factorial(2*n+c-1-k)*factorial(2*n-k)*factorial(c+k-1)*factorial(k))$
  99. % gosper(sub(n=n+1,summand)-summand,k);
  100. % Saalschuetz
  101. % summand:=factorial(a+k-1)*factorial(b+k-1)*factorial(n)*
  102. % factorial(n+c-a-b-k-1)*factorial(n+c-1)/(factorial(k)*factorial(n-k)*
  103. % factorial(k+c-1)*factorial(n+c-a-1)*factorial(n+c-b-1))$
  104. % gosper(sub(n=n+1,summand)-summand,k);
  105. % Dixon
  106. % summand:=(-1)^k*binomial(n+b,n+k)*binomial(n+c,c+k)*binomial(b+c,b+k)*
  107. % factorial(n)*factorial(b)*factorial(c)/factorial(n+b+c)$
  108. % gosper(sub(n=n+1,summand)-summand,k);
  109. % 3) Results from Gosper's original work
  110. % R. W. Gosper, Jr.:
  111. % Decision procedure for indefinite hypergeometric summation,
  112. % Proc. Nat. Acad. Sci. USA 75 (1978), 40-42.
  113. % ff(k)=product(a+b*j+c*j^2,j,1,k);
  114. % gg(k)=product(e+b*j+c*j^2,j,1,k);
  115. operator ff,gg;
  116. let {ff(~k+~m) => ff(k+m-1)*(c*(k+m)^2+b*(k+m)+a)
  117. when (fixp(m) and m>0),
  118. ff(~k+~m) => ff(k+m+1)/(c*(k+m+1)^2+b*(k+m+1)+a)
  119. when (fixp(m) and m<0)};
  120. let {gg(~k+~m) => gg(k+m-1)*(c*(k+m)^2+b*(k+m)+e)
  121. when (fixp(m) and m>0),
  122. gg(~k+~m) => gg(k+m+1)/(c*(k+m+1)^2+b*(k+m+1)+e)
  123. when (fixp(m) and m<0)};
  124. gosper(ff(k-1)/gg(k),k);
  125. % gosper(ff(k-1)/gg(k+1),k);
  126. % gosper(ff(k-1)/gg(k+2),k);
  127. % ff(k)=product(a+b*j+c*j^2+d*j^3,j,1,k);
  128. % gg(k)=product(e+b*j+c*j^2+d*j^3,j,1,k);
  129. let {
  130. ff(~k+~m) => ff(k+m-1)*(d*(k+m)^3+c*(k+m)^2+b*(k+m)+a)
  131. when (fixp(m) and m>0),
  132. ff(~k+~m) => ff(k+m+1)/(d*(k+m+1)^3+c*(k+m+1)^2+b*(k+m+1)+a)
  133. when (fixp(m) and m<0)};
  134. let {
  135. gg(~k+~m) => gg(k+m-1)*(d*(k+m)^3+c*(k+m)^2+b*(k+m)+e)
  136. when (fixp(m) and m>0),
  137. gg(~k+~m) => gg(k+m+1)/(d*(k+m+1)^3+c*(k+m+1)^2+b*(k+m+1)+e)
  138. when (fixp(m) and m<0)};
  139. gosper(ff(k-1)/gg(k),k);
  140. gosper(ff(k-1)/gg(k+1),k);
  141. % Decision: no closed form solution exists
  142. % ff(k)=product(a+b*j+c*j^2+d*j^3+e*j^4,j,1,k);
  143. % gg(k)=product(f+b*j+c*j^2+d*j^3+e*j^4,j,1,k);
  144. let {
  145. ff(~k+~m) => ff(k+m-1)*(e*(k+m)^4+d*(k+m)^3+c*(k+m)^2+b*(k+m)+a)
  146. when (fixp(m) and m>0),
  147. ff(~k+~m) => ff(k+m+1)/(e*(k+m+1)^4+d*(k+m+1)^3+c*(k+m+1)^2+b*(k+m+1)+a)
  148. when (fixp(m) and m<0)};
  149. let {
  150. gg(~k+~m) => gg(k+m-1)*(e*(k+m)^4+d*(k+m)^3+c*(k+m)^2+b*(k+m)+f)
  151. when (fixp(m) and m>0),
  152. gg(~k+~m) =>
  153. gg(k+m+1)/(e*(k+m+1)^4+d*(k+m+1)^3+c*(k+m+1)^2+b*(k+m+1)+f)
  154. when (fixp(m) and m<0)};
  155. gosper(ff(k-1)/gg(k),k);
  156. % ff=product(j^3+b*j^2+c*j+(2*c-4*b+8),j,1,k);
  157. % gg=product(j^3+b*j^2+c*j,j,1,k)
  158. let {
  159. ff(~k+~m) => ff(k+m-1)*((k+m)^3+c*(k+m)^2+b*(k+m)+(2*c-4*b+8))
  160. when (fixp(m) and m>0),
  161. ff(~k+~m) => ff(k+m+1)/((k+m+1)^2+c*(k+m+1)^2+b*(k+m+1)+(2*c-4*b+8))
  162. when (fixp(m) and m<0)};
  163. let {
  164. gg(~k+~m) => gg(k+m-1)*((k+m)^3+c*(k+m)^2+b*(k+m)+1)
  165. when (fixp(m) and m>0),
  166. gg(~k+~m) => gg(k+m+1)/((k+m+1)^2+c*(k+m+1)^2+b*(k+m+1)+1)
  167. when (fixp(m) and m<0)};
  168. gosper(ff(k-1)/gg(k),k);
  169. clear(ff,gg);
  170. % 4) Examples for which gosper decides that no hypergeometric term
  171. % antidifference exists
  172. gosper(factorial(k),k);
  173. gosper(factorial(2*k)/(factorial(k)*factorial(k+1)),k);
  174. % gosper(1/(factorial(k)*(k^4+k^2+1)),k);
  175. gosper(binomial(A,k),k);
  176. gosper(1/k,k);
  177. gosper((1+k)/(1-k),k);
  178. % gosper(3^k*(3*k^2+2*a*k-4*k-2-a)/((2*k+2+a)*(2*k+a)*(k+1)*k),k);
  179. gosper(factorial(k+n)*factorial(n)/
  180. ((-1)^k*factorial(n-k)*factorial(k)*2^k),k);
  181. gosper(1/(k*(k+1/2)),k);
  182. gosper(pochhammer(a,k),k);
  183. gosper(binomial(n,k),k);
  184. % 5) Finding recurrence equations for definite sums
  185. % D. Zeilberger,
  186. % A fast algorithm for proving terminating hypergeometric identities,
  187. % Discrete Math. 80 (1990), 207-211.
  188. sumrecursion(binomial(n,k),k,n);
  189. sumrecursion(k*binomial(n,k),k,n);
  190. % sumrecursion(
  191. % (-1)^k*binomial(2*n,k)*binomial(2*k,k)*binomial(4*n-2*k,2*n-k),k,n);
  192. sumrecursion(binomial(n,k)^2,k,n);
  193. sumrecursion(binomial(n,k)^2/binomial(2*n,n),k,n);
  194. % sumrecursion((-1)^k*binomial(n,k)^2,k,n);
  195. % Gauss
  196. sumrecursion(
  197. factorial(n+k)*factorial(b+k)*factorial(c-n-1)*factorial(c-b-1),k,n);
  198. sumrecursion(
  199. pochhammer(a,k)*pochhammer(b,k)/(factorial(k)*pochhammer(c,k)),k,a);
  200. % Kummer
  201. sumrecursion((-1)^(n+k)*factorial(2*n+c-1)*factorial(n)*factorial(n+c-1)
  202. /(factorial(2*n+c-1-k)*factorial(2*n-k)*factorial(c+k-1)*
  203. factorial(k)),k,n);
  204. sumrecursion((-1)^k/(
  205. factorial(2*n+c-1-k)*factorial(2*n-k)*factorial(c+k-1)*
  206. factorial(k)),k,n);
  207. % Saalschuetz
  208. % sumrecursion(factorial(a+k-1)*factorial(b+k-1)*factorial(n)*
  209. % factorial(n+c-a-b-k-1)*factorial(n+c-1)/
  210. % (factorial(k)*factorial(n-k)*factorial(k+c-1)*
  211. % factorial(n+c-a-1)*factorial(n+c-b-1)),k,n);
  212. sumrecursion(factorial(a+k-1)*factorial(b+k-1)*factorial(n+c-a-b-k-1)/(
  213. factorial(k)*factorial(n-k)*factorial(k+c-1)),k,n);
  214. % Dixon
  215. % sumrecursion((-1)^k*binomial(n+b,n+k)*binomial(n+c,c+k)*
  216. % binomial(b+c,b+k)*
  217. % factorial(n)*factorial(b)*factorial(c)/factorial(n+b+c),k,n);
  218. sumrecursion((-1)^k*binomial(n+b,n+k)*binomial(n+c,c+k)*
  219. binomial(b+c,b+k),k,n);
  220. sumrecursion((-1)^(k-n)*binomial(2*n,k)^3,k,n);
  221. sumrecursion(
  222. (-1)^(k-n)*binomial(2*n,k)^3/(binomial(3*n,n)*binomial(2*n,n)),k,n);
  223. % Clausen
  224. % summand:=factorial(a+k-1)*factorial(b+k-1)/
  225. % (factorial(k)*factorial(-1/2+a+b+k))*factorial(a+n-k-1)*
  226. % factorial(b+n-k-1)/(factorial(n-k)*factorial(-1/2+a+b+n-k))$
  227. % sumrecursion(summand,k,n);
  228. % Dougall
  229. % summand:=
  230. % pochhammer(d,k)*pochhammer(1+d/2,k)*pochhammer(d+b-a,k)*
  231. % pochhammer(d+c-a,k)*
  232. % pochhammer(1+a-b-c,k)*pochhammer(n+a,k)*pochhammer(-n,k)/
  233. % (factorial(k)*
  234. % pochhammer(d/2,k)*pochhammer(1+a-b,k)*pochhammer(1+a-c,k)*
  235. % pochhammer(b+c+d-a,k)*pochhammer(1+d-a-n,k)*pochhammer(1+d+n,k))$
  236. % sumrecursion(summand,k,n);
  237. % Apery
  238. sumrecursion(binomial(n,k)^2*binomial(n+k,k)^2,k,n);
  239. % sumrecursion(4*(-1)^k*binomial(m-1,k)*binomial(2*m-1,2*k)/
  240. % binomial(4*m-1,4*k)*(4*m^2+16*k^2-16*k*m+16*k-6*m+3)/
  241. % ((4*m-4*k-3)*(4*m-4*k-1)),k,m);
  242. sumrecursion((-1)^k*binomial(n,k)*binomial(k,n),k,n);
  243. sumrecursion((-1)^k*binomial(n,k)*binomial(2*k,n),k,n);
  244. sumrecursion((-1)^k*binomial(n,k)*binomial(k,j)^2,k,n);
  245. sumrecursion(binomial(n,k)*binomial(a,k),k,n);
  246. sumrecursion((3*k-2*n)*binomial(n,k)^2*binomial(2*k,k),k,n);
  247. sumrecursion(binomial(n-k,k),k,n);
  248. sumrecursion(binomial(n,k)*binomial(n+k,k),k,n);
  249. % sumrecursion(binomial(n+k,m+2*k)*binomial(2*k,k)*(-1)^k/(k+1),k,n);
  250. sumrecursion((-1)^k*binomial(n-k,k)*binomial(n-2*k,m-k),k,n);
  251. % sumrecursion((-1)^k*binomial(n-k,k)*binomial(n-2*k,m-k),k,m);
  252. sumrecursion(binomial(n+k,2*k)*2^(n-k),k,n);
  253. sumrecursion(binomial(n,k)*binomial(2*k,k)*(-1/4)^k,k,n);
  254. % sumrecursion(binomial(n,i)*binomial(2*n,n-i),i,n);
  255. sumrecursion((-1)^k*binomial(n,k)*binomial(2*k,k)*4^(n-k),k,n);
  256. sumrecursion((-1)^k*binomial(n,k)/binomial(k+a,k),k,n);
  257. % sumrecursion((-1)^k*binomial(n,k)/binomial(k+a,k),k,a);
  258. sumrecursion((-1)^(n-k)*binomial(2*n,k)^2,k,n);
  259. sumrecursion(factorial(a+k)*factorial(b+k)*factorial(n+c-a-b-k-1)/(
  260. factorial(k+1)*factorial(n-k)*factorial(k+c)),k,a);
  261. % sumrecursion(factorial(a+k)*factorial(b+k)*factorial(n+c-a-b-k-1)/(
  262. % factorial(k+1)*factorial(n-k)*factorial(k+c)),k,b);
  263. % sumrecursion(factorial(a+k)*factorial(b+k)*factorial(n+c-a-b-k-1)/(
  264. % factorial(k+1)*factorial(n-k)*factorial(k+c)),k,c);
  265. sumrecursion(binomial(2*n+1,2*p+2*k+1)*binomial(p+k,k),k,n);
  266. % sumrecursion(binomial(2*n+1,2*p+2*k+1)*binomial(p+k,k),k,p);
  267. sumrecursion(binomial(r,m)*binomial(s,t-m),m,r);
  268. % sumrecursion(binomial(r,m)*binomial(s,t-m),m,s);
  269. % sumrecursion(binomial(r,m)*binomial(s,t-m),m,t);
  270. sumrecursion(binomial(2*n+1,2*k)*binomial(m+k,2*n),k,n);
  271. % sumrecursion(binomial(2*n+1,2*k)*binomial(m+k,2*n),k,m);
  272. sumrecursion(binomial(n,k)*binomial(k,j)*x^j,k,n);
  273. % sumrecursion(binomial(n,k)*binomial(k,j)*x^j,k,j);
  274. % sumrecursion(binomial(n,k)*binomial(k,j)*x^k,k,n);
  275. sumrecursion(x*binomial(n+k,2*k)*((x^2-1)/4)^(n-k),k,n);
  276. sumrecursion(binomial(n+k-1,2*k-1)*(x-1)^(2*k)*x^(n-k)/k,k,n);
  277. sumrecursion(
  278. 1/(k+1)*binomial(2*k,k)/(n-k+1)*binomial(2*n-2*k,n-k),k,n);
  279. sumrecursion(binomial(m,r)*binomial(n-r,n-r-q)*(t-1)^r,r,m);
  280. % sumrecursion(binomial(m,r)*binomial(n-r,n-r-q)*(t-1)^r,r,n);
  281. % sumrecursion(binomial(m,r)*binomial(n-r,n-r-q)*(t-1)^r,r,q);
  282. % sumrecursion(binomial(m,r)*binomial(n-r,n-r-q)*(t-1)^r,r,r);
  283. sumrecursion(pochhammer(-n/2,k)*pochhammer(-n/2+1/2,k)/
  284. (factorial(k)*pochhammer(b+1/2,k)),k,n);
  285. % Watson
  286. % sumrecursion(pochhammer(a,k)*pochhammer(b,k)*pochhammer(c,k)/(
  287. % factorial(k)*pochhammer(1/2*(a+b+1),k)*pochhammer(2*c,k)),k,c);
  288. % sumrecursion(pochhammer(-m,j)*pochhammer(m+2*k+2,j)*pochhammer(k+1/2,j)/
  289. % (factorial(j)*pochhammer(k+3/2,j)*pochhammer(2*k+1,j)),j,k);
  290. sumrecursion((-1)^k*binomial(n,k)^3,k,n);
  291. % sumrecursion(pochhammer(-n,k)*pochhammer(n+2*a,k)*pochhammer(a,k)/(
  292. % factorial(k)*pochhammer(2*a/2,k)*pochhammer((2*a+1)/2,k))*(2/4)^k,k,n);
  293. % sumrecursion(pochhammer(-n,k)*pochhammer(n+4*a,k)*pochhammer(a,k)/(
  294. % factorial(k)*pochhammer(4*a/2,k)*pochhammer((4*a+1)/2,k))*(4/4)^k,k,n);
  295. % sumrecursion(binomial(n+k+1,n-k)*pochhammer(-n+k,j)*pochhammer(k+1/2,j)*
  296. % pochhammer(n+k+2,j)/(factorial(j)*pochhammer(k+3/2,j)*
  297. % pochhammer(2*k+1,j)),j,n);
  298. % sumrecursion(pochhammer(-m,j)*pochhammer(m+2*k+2,j)*
  299. % pochhammer(k+1/2,j)/(
  300. % factorial(j)*pochhammer(k+3/2,j)*pochhammer(2*k+1,j)),j,m);
  301. % sumrecursion(binomial(n+k+1,n-k)*pochhammer(-n+k,j)*
  302. % pochhammer(k+1/2,j)*
  303. % pochhammer(n+k+2,j)/(factorial(j)*pochhammer(k+3/2,j)*
  304. % pochhammer(2*k+1,j)),
  305. % j,k);
  306. % sumrecursion(pochhammer(a+b+c-n,j+l)*pochhammer(a+b-n/2,j+l)/
  307. % (factorial(j)*factorial(l)*pochhammer(a-n/2+1,j)*
  308. % pochhammer(b-n/2+1,l)),j,a);
  309. % sumrecursion(pochhammer(a+b+c-n,j+l)*pochhammer(a+b-n/2,j+l)/
  310. % (factorial(j)*factorial(l)*pochhammer(a-n/2+1,j)*
  311. % pochhammer(b-n/2+1,l)),j,b);
  312. sumrecursion(pochhammer(a+b+c-n,j+l)*pochhammer(a+b-n/2,j+l)/
  313. (factorial(j)*factorial(l)*pochhammer(a-n/2+1,j)*
  314. pochhammer(b-n/2+1,l)),j,c);
  315. % sumrecursion(
  316. % (-1)^(a+b+c)*gamma(a+b+c-d/2)*gamma(d/2-c)*gamma(a+c-d/2)*
  317. % gamma(b+c-d/2)/
  318. % (gamma(a)*gamma(b)*gamma(d/2)*gamma(a+b+2*c-d)*(m^2)^(a+b+c-d))*
  319. % pochhammer(a+b+c-d,k)*pochhammer(a+c-d/2,k)/
  320. % (pochhammer(a+b+2*c-d,k)*factorial(k)),k,a);
  321. % sumrecursion(
  322. % (-1)^(a+b+c)*gamma(a+b+c-d/2)*gamma(d/2-c)*gamma(a+c-d/2)*
  323. % gamma(b+c-d/2)/
  324. % (gamma(a)*gamma(b)*gamma(d/2)*gamma(a+b+2*c-d)*(m^2)^(a+b+c-d))*
  325. % pochhammer(a+b+c-d,k)*pochhammer(a+c-d/2,k)/
  326. % (pochhammer(a+b+2*c-d,k)*factorial(k)),k,b);
  327. % sumrecursion(
  328. % (-1)^(a+b+c)*gamma(a+b+c-d/2)*gamma(d/2-c)*gamma(a+c-d/2)*
  329. % gamma(b+c-d/2)/
  330. % (gamma(a)*gamma(b)*gamma(d/2)*gamma(a+b+2*c-d)*(m^2)^(a+b+c-d))*
  331. % pochhammer(a+b+c-d,k)*pochhammer(a+c-d/2,k)/
  332. % (pochhammer(a+b+2*c-d,k)*factorial(k)),k,c);
  333. % sumrecursion(pochhammer(-n,k)*pochhammer(n+3*a,k)*pochhammer(a,k)/(
  334. % factorial(k)*pochhammer(3*a/2,k)*
  335. % pochhammer((3*a+1)/2,k))*(3/4)^k,k,n);
  336. % summand:=k*(-1)^j*pochhammer(2*k+j+1,j)*pochhammer(2*k+2*j+2,n-k-j)/(
  337. % factorial(k+j)*factorial(j)*factorial(n-k-j))*exp(-(j+k)*t)$
  338. % summand:=k*(-1)^j*pochhammer(2*k+j+1,j)*pochhammer(2*k+2*j+2,n-k-j)/(
  339. % (k+j)*factorial(j)*factorial(n-k-j))*exp(-(j+k)*t)$
  340. % sumrecursion(summand,j,n);
  341. clear(summand);
  342. % 6) Finding recurrence equations for hypergeometric functions
  343. % Koornwinder, T. H.:
  344. % On Zeilberger's algorithm and
  345. % its q-analogue: a rigorous description.
  346. % J. of Comput. and Appl. Math. 48, 1993, 91-111.
  347. % Gauss
  348. hyperrecursion({a,b},{c},1,a);
  349. % Dougall
  350. % hyperrecursion({d,1+d/2,d+b-a,d+c-a,1+a-b-c,n+a,-n},
  351. % {d/2,1+a-b,1+a-c,b+c+d-a,1+d-a-n,1+d+n},1,n);
  352. % Baxter
  353. % hyperrecursion({-n,-n-1,-n-2},{2,3},-1,n);
  354. % Krawtchouk polynomials
  355. % krawtchoukterm :=
  356. % (-1)^n*p^n*binomial(NN,n)*hyperterm({-n,-x},{-NN},1/p,k)$
  357. % sumrecursion(krawtchoukterm,k,n);
  358. % sumrecursion(krawtchoukterm,k,x);
  359. % sumrecursion(krawtchoukterm,k,NN);
  360. % clear(krawtchoukterm);
  361. % hyperrecursion({-n,b,c+4},{b+1,c},1,n);
  362. hyperrecursion({-n,b,c+1,d+1},{b+1,c,d},1,n);
  363. % 7) Extended versions of Gosper's and Zeilberger's algorithms
  364. % Koepf, W.:
  365. % Algorithms for the indefinite and definite summation.
  366. % Konrad-Zuse-Zentrum Berlin (ZIB), Preprint SC 94-33, 1994.
  367. % extended Gosper algorithm
  368. extended_gosper(k*factorial(k/7),k,7);
  369. extended_gosper(k*factorial(k/2),k,2);
  370. extended_gosper(k*factorial(k/2),k);
  371. extended_gosper(binomial(k/2,n),k);
  372. extended_gosper(binomial(n,k/2)-binomial(n,k/2-1),k);
  373. % extended Zeilberger algorithm
  374. % extended_sumrecursion(binomial(n,k)*binomial(k/2,n),k,n,1,2);
  375. sumrecursion(binomial(n,k)*binomial(k/2,n),k,n);
  376. extended_sumrecursion(binomial(n/2,k),k,n,2,1);
  377. sumrecursion(binomial(n/2,k),k,n);
  378. % sumrecursion(hyperterm({a,b,a+1/2-b,1+2*a/3,-n},
  379. % {2*a+1-2*b,2*b,2/3*a,1+a+n/2},4,k)/
  380. % (factorial(n)*2^(-n)/factorial(n/2))/
  381. % hyperterm({a+1,1},{a-b+1,b+1/2},1,n/2),k,n);
  382. % Watson
  383. % sumrecursion(pochhammer(a,k)*pochhammer(b,k)*pochhammer(c,k)/(
  384. % factorial(k)*pochhammer(1/2*(a+b+1),k)*pochhammer(2*c,k))/
  385. % (GAMMA(1/2)*GAMMA(1/2+c)*GAMMA(1/2+a/2+b/2)*GAMMA(1/2-a/2-b/2+c))*
  386. % GAMMA(1/2+a/2)*GAMMA(1/2+b/2)*GAMMA(1/2-a/2+c)*GAMMA(1/2-b/2+c),k,a);
  387. % hyperrecursion({a,b,c},{1/2*(a+b+1),2*c},1,a);
  388. % hyperrecursion({a,b,c},{1/2*(a+b+1),2*c},1,b);
  389. % 8) Closed form representations of hypergeometric sums
  390. % Vandermonde
  391. hypersum({-n,b},{c},1,n);
  392. % Saalschuetz
  393. hypersum({a,b,-n},{c,1+a+b-c-n},1,n);
  394. % Kummer
  395. hypersum({a,-n},{1+a+n},-1,n);
  396. % Dixon
  397. hypersum({a,b,-n},{1+a-b,1+a+n},1,n);
  398. % Dougall
  399. % hypersum({a,1+a/2,b,c,d,1+2*a-b-c-d+n,-n},
  400. % {a/2,1+a-b,1+a-c,1+a-d,1+a-(1+2*a-b-c-d+n),1+a+n},1,n);
  401. % Clausen
  402. % hypersum({a,b,1/2-a-b-n,-n},{1/2+a+b,1-a-n,1-b-n},1,n);
  403. hypersum({a,1+a/2,c,d,-n},{a/2,1+a-c,1+a-d,1+a+n},1,n);
  404. hypersum({a,1+a/2,d,-n},{a/2,1+a-d,1+a+n},-1,n);
  405. % m-fold case:
  406. hypersum({-n,-n,-n},{1,1},1,n);
  407. % hypersum({-n,n+3*a,a},{3*a/2,(3*a+1)/2},3/4,n);
  408. % 9) Hypergeometric representations
  409. sumtohyper(binomial(n,k)^3,k);
  410. sumtohyper(binomial(n,k)/2^n-sub(n=n-1,binomial(n,k)/2^n),k);
  411. sumtohyper(binomial(k+j-1,k-j)*2*(-1)^(j+1)*factorial(2*j-1)/
  412. factorial(j-1)/factorial(j+1)*x^j,j);
  413. % term:=1/(n-1+k)*(1/2-1/2*x)^k/n*binomial(k-n-1,-n-1)*k*
  414. % binomial(n-1+k,n-1);
  415. % sumtohyper(sub(n=n+1,term)-term,k);
  416. end;