ZEILBERG.LOG 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  1. REDUCE 3.6, 15-Jul-95, patched to 6 Mar 96 ...
  2. % Tests of the ZEILBERG package.
  3. % Authors: Gregor Stoelting, Wolfram Koepf (koepf@zib-berlin.de)
  4. load zeilberg;
  5. *** gamma already defined as operator
  6. *** pochhammer already defined as operator
  7. *** binomial already defined as operator
  8. *** hypergeom already defined as operator
  9. *** summ already defined as operator
  10. *** zb_f already defined as operator
  11. *** zb_sigma already defined as operator
  12. *** local_gamma already defined as operator
  13. *** local_prod already defined as operator
  14. *** hypergeometric already defined as operator
  15. *** zb_subst already defined as operator
  16. % on time;
  17. % 1) Successful summations by the Gosper algorithm
  18. % R. W. Gosper, Jr.:
  19. % Decision procedure for indefinite hypergeometric summation,
  20. % Proc. Nat. Acad. Sci. USA 75 (1978), 40-42.
  21. gosper(k,k);
  22. (k + 1)*k
  23. -----------
  24. 2
  25. gosper(k^2,k);
  26. (2*k + 1)*(k + 1)*k
  27. ---------------------
  28. 6
  29. gosper(k^3,k);
  30. 2 2
  31. (k + 1) *k
  32. -------------
  33. 4
  34. gosper(k^4,k);
  35. 2
  36. (3*k + 3*k - 1)*(2*k + 1)*(k + 1)*k
  37. --------------------------------------
  38. 30
  39. gosper(k^5,k);
  40. 2 2 2
  41. (2*k + 2*k - 1)*(k + 1) *k
  42. ------------------------------
  43. 12
  44. % gosper(k^20,k);
  45. gosper((6*k+3)/(4*k^4+8*k^3+8*k^2+4*k+3),k);
  46. (k + 2)*k
  47. ----------------
  48. 2
  49. 2*k + 4*k + 3
  50. % gosper(2^k*(k^3-3*k^2-3*k-1)/(k^3*(k+1)^3),k);
  51. gosper(x*k,k);
  52. (k + 1)*k*x
  53. -------------
  54. 2
  55. gosper(k*x^k,k);
  56. k
  57. x *((x - 1)*k - 1)*x
  58. ----------------------
  59. 2
  60. (x - 1)
  61. gosper(k*factorial(k),k);
  62. (k + 1)*factorial(k)
  63. gosper(1/(k^2-1),k);
  64. 2
  65. 2*k - 1
  66. -------------
  67. 2*(k + 1)*k
  68. gosper((1+2*k)/((1+k^2)*(k^2+2*k+2)),k);
  69. (k + 2)*k
  70. ------------------
  71. 2
  72. 2*(k + 2*k + 2)
  73. gosper((k^2+4*k+1)*factorial(k),k);
  74. (k + 4)*(k + 1)*factorial(k)
  75. gosper((4*k-3)*factorial(2*k-2)/factorial(k-1),k);
  76. 2*(2*k - 1)*factorial(2*(k - 1))
  77. ----------------------------------
  78. factorial(k - 1)
  79. gosper(gamma(k+n+2)*n/((k+n+1)*gamma(k+2)*gamma(n+1)),k);
  80. gamma(n + 2 + k)
  81. ---------------------------
  82. gamma(k + 2)*gamma(n + 1)
  83. gosper((k+n)*factorial(k+n),k);
  84. (n + 1 + k)*factorial(k + n)
  85. gosper((3*(1+2*k))/((1+k^2)*(2+2*k+k^2)),k);
  86. 3*(k + 2)*k
  87. ------------------
  88. 2
  89. 2*(k + 2*k + 2)
  90. % gosper((-25+15*k+18*k^2-2*k^3-k^4)/
  91. % (-23+479*k+613*k^2+137*k^3+53*k^4+5*k^5+k^6),k);
  92. % 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);
  93. gosper(3^k*(4*k^2-2*k-3)/((2*k+3)*(2*k+1)*(k+1)*k),k);
  94. k
  95. 3*3
  96. -------------------
  97. (2*k + 3)*(k + 1)
  98. % gosper(2^k*(2*k^3+3*k^2-20*k-15)/
  99. % ((2*k+3)*(2*k+1)*(k+5)*(k+4)*(k+1)*k),k);
  100. % gosper(-2^k*((k+11)^2*(k+1)^2-2*(k+10)^2*k^2)/
  101. % ((k+11)^2*(k+10)^2*(k+1)^2*k^2),k);
  102. % gosper(-2^k*((k+6)^2*(k+1)^2-2*(k+5)^2*k^2)/
  103. % ((k+6)^2*(k+5)^2*(k+1)^2*k^2),k);
  104. % gosper(2^k*(k^4-14*k^2-24*k-9)/(k^2*(k+1)^2*(k+2)^2*(k+3)^2),k);
  105. % gosper(((k^2-k-n^2-n-2)*gamma(k+n+2)*gamma(n+1))/
  106. % (2*(-1)^k*2^k*(k+n+1)*gamma(-(k-n-1))*gamma(k+2)),k);
  107. % gosper(1/(k+1)*binomial(2*k,k)/(n-k+1)*binomial(2*n-2*k,n-k),k);
  108. gosper(3^k*(4*k^2+2*a*k-4*k-2-a)/((2*k+2+a)*(2*k+a)*(k+1)*k),k);
  109. k
  110. 3*3
  111. -------------------------
  112. (2*(k + 1) + a)*(k + 1)
  113. gosper(2^k*(k^2-2*k-1)/(k^2*(k+1)^2),k);
  114. k
  115. 2*2
  116. ----------
  117. 2
  118. (k + 1)
  119. gosper((3*k^2+3*k+1)/(k^3*(k+1)^3),k);
  120. 2
  121. (k + 3*k + 3)*k
  122. ------------------
  123. 3
  124. (k + 1)
  125. gosper((6*k+3)/(4*k^4+8*k^3+8*k^2+4*k+3),k);
  126. (k + 2)*k
  127. ----------------
  128. 2
  129. 2*k + 4*k + 3
  130. gosper(-(k^2+3*k+3)/(k^4+2*k^3-3*k^2-4*k+2),k);
  131. (2*k + 5)*k
  132. --------------
  133. 2
  134. k + 2*k - 1
  135. gosper(k^2*4^k/((k+1)*(k+2)),k);
  136. k
  137. 4*4 *(k - 1)
  138. --------------
  139. 3*(k + 2)
  140. gosper((2*k-1)^3,k);
  141. 2 2
  142. (2*k - 1)*k
  143. gosper(3*k^2+3*k+1,k);
  144. 2
  145. (k + 3*k + 3)*k
  146. gosper((k^2+4*k+2)*2^k,k);
  147. k 2
  148. 2*2 *(k + 1)
  149. % gosper(2^k*(k^3-3*k^2-3*k-1)/(k^3*(k+1)^3),k);
  150. gosper(k*n^k,k);
  151. k
  152. n *((n - 1)*k - 1)*n
  153. ----------------------
  154. 2
  155. (n - 1)
  156. % gosper(3^k*(2*k^3+k^2+3*k+6)/((k^2+2)*(k^2+2*k+3)),k);
  157. % gosper(4*(1-k)*(k^2-2*k-1)/(k^2*(k+1)^2*(k-2)^2*(k-3)^2),k);
  158. % gosper(2^k*(k^4-14*k^2-24*k-9)/(k^2*(k+1)^2*(k+2)^2*(k+3)^2),k);
  159. gosper((1+k)/(1-k)+2/k,k);
  160. 2
  161. - (k - 2)
  162. -------------
  163. k
  164. gosper(1/(k*(k+1)),k);
  165. k
  166. -------
  167. k + 1
  168. gosper(1/(k*(k+2)),k);
  169. (3*k + 5)*k
  170. -------------------
  171. 4*(k + 2)*(k + 1)
  172. gosper(1/(k*(k+10)),k);
  173. 9 8 7 6 5 4
  174. ((7381*k + 380755*k + 8495520*k + 107353950*k + 844356513*k + 4272540195*k
  175. 3 2
  176. + 13854467330*k + 27627865100*k + 30558324456*k + 14171968800)*k)/(25200
  177. *(k + 10)*(k + 9)*(k + 8)*(k + 7)*(k + 6)*(k + 5)*(k + 4)*(k + 3)*(k + 2)
  178. *(k + 1))
  179. % gosper(1/(k*(k+30)),k);
  180. gosper(1/(k*(k+1)*(k+2)),k);
  181. (k + 3)*k
  182. -------------------
  183. 4*(k + 2)*(k + 1)
  184. gosper(1/(k*(k+1)*(k+2)*(k+3)*(k+4)*(k+5)*(k+6)*(k+7)*(k+8)*(k+9)*
  185. (k+10)),k);
  186. 8 7 6 5 4 3 2
  187. ((k + 44*k + 836*k + 8954*k + 59279*k + 249986*k + 667084*k + 1071576*k
  188. + 966240)*(k + 11)*k)/(36288000*(k + 10)*(k + 9)*(k + 8)*(k + 7)*(k + 6)
  189. *(k + 5)*(k + 4)*(k + 3)*(k + 2)*(k + 1))
  190. gosper(pochhammer(k-n,n),k);
  191. pochhammer(k - n,n)*k
  192. -----------------------
  193. n + 1
  194. gosper((a+k-1)*pochhammer(a,k),k);
  195. (a + k)*pochhammer(a,k)
  196. gosper((a-k-1)/pochhammer(a-k,k),k);
  197. - 1
  198. ---------------------
  199. pochhammer(a - k,k)
  200. gosper(binomial(k,n),k);
  201. (k + 1)*binomial(k,n)
  202. -----------------------
  203. n + 1
  204. gosper(k*binomial(k,n),k);
  205. (k*n + k + n)*(k + 1)*binomial(k,n)
  206. -------------------------------------
  207. (n + 2)*(n + 1)
  208. % gosper(k^10*binomial(k,n),k);
  209. gosper(1/binomial(k,n),k);
  210. n - 1 - k
  211. -----------------------
  212. (n - 1)*binomial(k,n)
  213. gosper(k/binomial(k,n),k);
  214. (n - 1 - k)*k
  215. -----------------------
  216. (n - 2)*binomial(k,n)
  217. % gosper(k^10/binomial(k,n),k);
  218. gosper(binomial(k-n,k),k);
  219. (n - 1 - k)*binomial(k - n,k)
  220. -------------------------------
  221. n - 1
  222. gosper((-1)^k*binomial(n,k),k);
  223. k
  224. - ( - 1) *(k - n)*binomial(n,k)
  225. ----------------------------------
  226. n
  227. gosper((-1)^k/binomial(n,k),k);
  228. k
  229. ( - 1) *(k + 1)
  230. -----------------------
  231. (n + 2)*binomial(n,k)
  232. gosper((-1)^(k+1)*(4*k+1)*factorial(2*k)/
  233. (factorial(k)*4^k*(2*k-1)*factorial(k+1)),k);
  234. k
  235. - ( - 1) *factorial(2*k)
  236. ----------------------------------
  237. k
  238. 4 *factorial(k + 1)*factorial(k)
  239. % term:=3^k*(3*k^2+2*a*k-4*k-2-a)/((2*k+2+a)*(2*k+a)*(k+1)*k)$
  240. % term:=sub(k=k+3,term)-term$
  241. % gosper(term,k);
  242. % clear(term);
  243. % 2) Examples for the Wilf-Zeilberger method:
  244. % H. S. Wilf and D. Zeilberger:
  245. % Rational functions certify combinatorial identities.
  246. % J. Amer. Math. Soc. 3, 1990, 147-158.
  247. % Binomial theorem
  248. summand:=binomial(n,k)/2^n$
  249. gosper(sub(n=n+1,summand)-summand,k);
  250. (n + 1 - k)*(binomial(n + 1,k) - 2*binomial(n,k))
  251. ---------------------------------------------------
  252. n
  253. 2*2 *(n + 1 - 2*k)
  254. % Vandermonde
  255. summand:=binomial(n,k)^2/binomial(2*n,n)$
  256. gosper(sub(n=n+1,summand)-summand,k);
  257. 2 2
  258. ((binomial(n + 1,k) *binomial(2*n,n) - binomial(2*(n + 1),n + 1)*binomial(n,k) )
  259. 2
  260. *(2*k - 3*n - 1)*(k - n - 1) )/(
  261. 2
  262. (2*(2*(n + 1) - k)*(2*n + 1)*k - (3*n + 1)*(n + 1) )
  263. *binomial(2*(n + 1),n + 1)*binomial(2*n,n))
  264. % Gauss
  265. % summand:=factorial(n+k)*factorial(b+k)*factorial(c-n-1)*factorial(c-b-1)
  266. % /(factorial(n-1)*factorial(c-n-b-1)*factorial(k+1)*factorial(c+k)*
  267. % factorial(b-1))$
  268. % gosper(sub(n=n+1,summand)-summand,k);
  269. % Kummer
  270. % summand:=(-1)^(n+k)*factorial(2*n+c-1)*factorial(n)*factorial(n+c-1)/(
  271. % factorial(2*n+c-1-k)*factorial(2*n-k)*factorial(c+k-1)*factorial(k))$
  272. % gosper(sub(n=n+1,summand)-summand,k);
  273. % Saalschuetz
  274. % summand:=factorial(a+k-1)*factorial(b+k-1)*factorial(n)*
  275. % factorial(n+c-a-b-k-1)*factorial(n+c-1)/(factorial(k)*factorial(n-k)*
  276. % factorial(k+c-1)*factorial(n+c-a-1)*factorial(n+c-b-1))$
  277. % gosper(sub(n=n+1,summand)-summand,k);
  278. % Dixon
  279. % summand:=(-1)^k*binomial(n+b,n+k)*binomial(n+c,c+k)*binomial(b+c,b+k)*
  280. % factorial(n)*factorial(b)*factorial(c)/factorial(n+b+c)$
  281. % gosper(sub(n=n+1,summand)-summand,k);
  282. % 3) Results from Gosper's original work
  283. % R. W. Gosper, Jr.:
  284. % Decision procedure for indefinite hypergeometric summation,
  285. % Proc. Nat. Acad. Sci. USA 75 (1978), 40-42.
  286. % ff(k)=product(a+b*j+c*j^2,j,1,k);
  287. % gg(k)=product(e+b*j+c*j^2,j,1,k);
  288. operator ff,gg;
  289. let {ff(~k+~m) => ff(k+m-1)*(c*(k+m)^2+b*(k+m)+a)
  290. when (fixp(m) and m>0),
  291. ff(~k+~m) => ff(k+m+1)/(c*(k+m+1)^2+b*(k+m+1)+a)
  292. when (fixp(m) and m<0)};
  293. let {gg(~k+~m) => gg(k+m-1)*(c*(k+m)^2+b*(k+m)+e)
  294. when (fixp(m) and m>0),
  295. gg(~k+~m) => gg(k+m+1)/(c*(k+m+1)^2+b*(k+m+1)+e)
  296. when (fixp(m) and m<0)};
  297. gosper(ff(k-1)/gg(k),k);
  298. ff(k)
  299. ---------------
  300. (a - e)*gg(k)
  301. % gosper(ff(k-1)/gg(k+1),k);
  302. % gosper(ff(k-1)/gg(k+2),k);
  303. % ff(k)=product(a+b*j+c*j^2+d*j^3,j,1,k);
  304. % gg(k)=product(e+b*j+c*j^2+d*j^3,j,1,k);
  305. let {
  306. ff(~k+~m) => ff(k+m-1)*(d*(k+m)^3+c*(k+m)^2+b*(k+m)+a)
  307. when (fixp(m) and m>0),
  308. ff(~k+~m) => ff(k+m+1)/(d*(k+m+1)^3+c*(k+m+1)^2+b*(k+m+1)+a)
  309. when (fixp(m) and m<0)};
  310. let {
  311. gg(~k+~m) => gg(k+m-1)*(d*(k+m)^3+c*(k+m)^2+b*(k+m)+e)
  312. when (fixp(m) and m>0),
  313. gg(~k+~m) => gg(k+m+1)/(d*(k+m+1)^3+c*(k+m+1)^2+b*(k+m+1)+e)
  314. when (fixp(m) and m<0)};
  315. gosper(ff(k-1)/gg(k),k);
  316. ff(k)
  317. ---------------
  318. (a - e)*gg(k)
  319. gosper(ff(k-1)/gg(k+1),k);
  320. ***** Gosper algorithm: no closed form solution exists
  321. % Decision: no closed form solution exists
  322. % ff(k)=product(a+b*j+c*j^2+d*j^3+e*j^4,j,1,k);
  323. % gg(k)=product(f+b*j+c*j^2+d*j^3+e*j^4,j,1,k);
  324. let {
  325. ff(~k+~m) => ff(k+m-1)*(e*(k+m)^4+d*(k+m)^3+c*(k+m)^2+b*(k+m)+a)
  326. when (fixp(m) and m>0),
  327. 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)
  328. when (fixp(m) and m<0)};
  329. let {
  330. gg(~k+~m) => gg(k+m-1)*(e*(k+m)^4+d*(k+m)^3+c*(k+m)^2+b*(k+m)+f)
  331. when (fixp(m) and m>0),
  332. gg(~k+~m) =>
  333. gg(k+m+1)/(e*(k+m+1)^4+d*(k+m+1)^3+c*(k+m+1)^2+b*(k+m+1)+f)
  334. when (fixp(m) and m<0)};
  335. gosper(ff(k-1)/gg(k),k);
  336. ff(k)
  337. ---------------
  338. (a - f)*gg(k)
  339. % ff=product(j^3+b*j^2+c*j+(2*c-4*b+8),j,1,k);
  340. % gg=product(j^3+b*j^2+c*j,j,1,k)
  341. let {
  342. ff(~k+~m) => ff(k+m-1)*((k+m)^3+c*(k+m)^2+b*(k+m)+(2*c-4*b+8))
  343. when (fixp(m) and m>0),
  344. 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))
  345. when (fixp(m) and m<0)};
  346. let {
  347. gg(~k+~m) => gg(k+m-1)*((k+m)^3+c*(k+m)^2+b*(k+m)+1)
  348. when (fixp(m) and m>0),
  349. gg(~k+~m) => gg(k+m+1)/((k+m+1)^2+c*(k+m+1)^2+b*(k+m+1)+1)
  350. when (fixp(m) and m<0)};
  351. gosper(ff(k-1)/gg(k),k);
  352. ff(k)
  353. -----------------------
  354. (2*c + 7 - 4*b)*gg(k)
  355. clear(ff,gg);
  356. % 4) Examples for which gosper decides that no hypergeometric term
  357. % antidifference exists
  358. gosper(factorial(k),k);
  359. ***** Gosper algorithm: no closed form solution exists
  360. gosper(factorial(2*k)/(factorial(k)*factorial(k+1)),k);
  361. ***** Gosper algorithm: no closed form solution exists
  362. % gosper(1/(factorial(k)*(k^4+k^2+1)),k);
  363. gosper(binomial(A,k),k);
  364. ***** Gosper algorithm: no closed form solution exists
  365. gosper(1/k,k);
  366. ***** Gosper algorithm: no closed form solution exists
  367. gosper((1+k)/(1-k),k);
  368. ***** Gosper algorithm: no closed form solution exists
  369. % gosper(3^k*(3*k^2+2*a*k-4*k-2-a)/((2*k+2+a)*(2*k+a)*(k+1)*k),k);
  370. gosper(factorial(k+n)*factorial(n)/
  371. ((-1)^k*factorial(n-k)*factorial(k)*2^k),k);
  372. ***** Gosper algorithm: no closed form solution exists
  373. gosper(1/(k*(k+1/2)),k);
  374. ***** Gosper algorithm: no closed form solution exists
  375. gosper(pochhammer(a,k),k);
  376. ***** Gosper algorithm: no closed form solution exists
  377. gosper(binomial(n,k),k);
  378. ***** Gosper algorithm: no closed form solution exists
  379. % 5) Finding recurrence equations for definite sums
  380. % D. Zeilberger,
  381. % A fast algorithm for proving terminating hypergeometric identities,
  382. % Discrete Math. 80 (1990), 207-211.
  383. sumrecursion(binomial(n,k),k,n);
  384. 2*summ(n - 1) - summ(n)
  385. sumrecursion(k*binomial(n,k),k,n);
  386. recursion valid for n>=2
  387. (n - 1)*summ(n) - 2*summ(n - 1)*n
  388. % sumrecursion(
  389. % (-1)^k*binomial(2*n,k)*binomial(2*k,k)*binomial(4*n-2*k,2*n-k),k,n);
  390. sumrecursion(binomial(n,k)^2,k,n);
  391. 2*(2*n - 1)*summ(n - 1) - summ(n)*n
  392. sumrecursion(binomial(n,k)^2/binomial(2*n,n),k,n);
  393. summ(n - 1) - summ(n)
  394. % sumrecursion((-1)^k*binomial(n,k)^2,k,n);
  395. % Gauss
  396. sumrecursion(
  397. factorial(n+k)*factorial(b+k)*factorial(c-n-1)*factorial(c-b-1),k,n);
  398. - ((n - 1 - c)*(c - n)*summ(n) + summ(n - 2))
  399. + (n - 1 - b)*(n - 1 - c)*summ(n - 1)
  400. sumrecursion(
  401. pochhammer(a,k)*pochhammer(b,k)/(factorial(k)*pochhammer(c,k)),k,a);
  402. (b - c + a)*summ(a) - (a - c)*summ(a - 1)
  403. % Kummer
  404. sumrecursion((-1)^(n+k)*factorial(2*n+c-1)*factorial(n)*factorial(n+c-1)
  405. /(factorial(2*n+c-1-k)*factorial(2*n-k)*factorial(c+k-1)*
  406. factorial(k)),k,n);
  407. summ(n - 1) - summ(n)
  408. sumrecursion((-1)^k/(
  409. factorial(2*n+c-1-k)*factorial(2*n-k)*factorial(c+k-1)*
  410. factorial(k)),k,n);
  411. (2*n - 1 + c)*(2*(n - 1) + c)*(n - 1 + c)*summ(n)*n + summ(n - 1)
  412. % Saalschuetz
  413. % sumrecursion(factorial(a+k-1)*factorial(b+k-1)*factorial(n)*
  414. % factorial(n+c-a-b-k-1)*factorial(n+c-1)/
  415. % (factorial(k)*factorial(n-k)*factorial(k+c-1)*
  416. % factorial(n+c-a-1)*factorial(n+c-b-1)),k,n);
  417. sumrecursion(factorial(a+k-1)*factorial(b+k-1)*factorial(n+c-a-b-k-1)/(
  418. factorial(k)*factorial(n-k)*factorial(k+c-1)),k,n);
  419. - (n - 1 + c - a)*(n - 1 + c - b)*summ(n - 1) + (n - 1 + c)*summ(n)*n
  420. % Dixon
  421. % sumrecursion((-1)^k*binomial(n+b,n+k)*binomial(n+c,c+k)*
  422. % binomial(b+c,b+k)*
  423. % factorial(n)*factorial(b)*factorial(c)/factorial(n+b+c),k,n);
  424. sumrecursion((-1)^k*binomial(n+b,n+k)*binomial(n+c,c+k)*
  425. binomial(b+c,b+k),k,n);
  426. (c + n + b)*summ(n - 1) - summ(n)*n
  427. sumrecursion((-1)^(k-n)*binomial(2*n,k)^3,k,n);
  428. 2
  429. 3*(3*n - 1)*(3*n - 2)*summ(n - 1) - summ(n)*n
  430. sumrecursion(
  431. (-1)^(k-n)*binomial(2*n,k)^3/(binomial(3*n,n)*binomial(2*n,n)),k,n);
  432. summ(n - 1) - summ(n)
  433. % Clausen
  434. % summand:=factorial(a+k-1)*factorial(b+k-1)/
  435. % (factorial(k)*factorial(-1/2+a+b+k))*factorial(a+n-k-1)*
  436. % factorial(b+n-k-1)/(factorial(n-k)*factorial(-1/2+a+b+n-k))$
  437. % sumrecursion(summand,k,n);
  438. % Dougall
  439. % summand:=
  440. % pochhammer(d,k)*pochhammer(1+d/2,k)*pochhammer(d+b-a,k)*
  441. % pochhammer(d+c-a,k)*
  442. % pochhammer(1+a-b-c,k)*pochhammer(n+a,k)*pochhammer(-n,k)/
  443. % (factorial(k)*
  444. % pochhammer(d/2,k)*pochhammer(1+a-b,k)*pochhammer(1+a-c,k)*
  445. % pochhammer(b+c+d-a,k)*pochhammer(1+d-a-n,k)*pochhammer(1+d+n,k))$
  446. % sumrecursion(summand,k,n);
  447. % Apery
  448. sumrecursion(binomial(n,k)^2*binomial(n+k,k)^2,k,n);
  449. 3 3
  450. - ((n - 1) *summ(n - 2) + summ(n)*n )
  451. 2
  452. + (17*n - 17*n + 5)*(2*n - 1)*summ(n - 1)
  453. % sumrecursion(4*(-1)^k*binomial(m-1,k)*binomial(2*m-1,2*k)/
  454. % binomial(4*m-1,4*k)*(4*m^2+16*k^2-16*k*m+16*k-6*m+3)/
  455. % ((4*m-4*k-3)*(4*m-4*k-1)),k,m);
  456. sumrecursion((-1)^k*binomial(n,k)*binomial(k,n),k,n);
  457. summ(n - 1) + summ(n)
  458. sumrecursion((-1)^k*binomial(n,k)*binomial(2*k,n),k,n);
  459. 2*summ(n - 1) + summ(n)
  460. sumrecursion((-1)^k*binomial(n,k)*binomial(k,j)^2,k,n);
  461. 2
  462. (n - 1 - 2*j)*summ(n - 1)*n - (j - n) *summ(n)
  463. sumrecursion(binomial(n,k)*binomial(a,k),k,n);
  464. (a + n)*summ(n - 1) - summ(n)*n
  465. sumrecursion((3*k-2*n)*binomial(n,k)^2*binomial(2*k,k),k,n);
  466. summ(n - 1) - summ(n)
  467. sumrecursion(binomial(n-k,k),k,n);
  468. summ(n - 1) - summ(n) + summ(n - 2)
  469. sumrecursion(binomial(n,k)*binomial(n+k,k),k,n);
  470. 6*summ(n - 1)*n - 3*summ(n - 1) - summ(n)*n - (n - 1)*summ(n - 2)
  471. % sumrecursion(binomial(n+k,m+2*k)*binomial(2*k,k)*(-1)^k/(k+1),k,n);
  472. sumrecursion((-1)^k*binomial(n-k,k)*binomial(n-2*k,m-k),k,n);
  473. summ(n - 1) - summ(n)
  474. % sumrecursion((-1)^k*binomial(n-k,k)*binomial(n-2*k,m-k),k,m);
  475. sumrecursion(binomial(n+k,2*k)*2^(n-k),k,n);
  476. 5*summ(n - 1) - summ(n) - 4*summ(n - 2)
  477. sumrecursion(binomial(n,k)*binomial(2*k,k)*(-1/4)^k,k,n);
  478. (2*n - 1)*summ(n - 1) - 2*summ(n)*n
  479. % sumrecursion(binomial(n,i)*binomial(2*n,n-i),i,n);
  480. sumrecursion((-1)^k*binomial(n,k)*binomial(2*k,k)*4^(n-k),k,n);
  481. 2*(2*n - 1)*summ(n - 1) - summ(n)*n
  482. sumrecursion((-1)^k*binomial(n,k)/binomial(k+a,k),k,n);
  483. summ(n - 1) + summ(n)
  484. % sumrecursion((-1)^k*binomial(n,k)/binomial(k+a,k),k,a);
  485. sumrecursion((-1)^(n-k)*binomial(2*n,k)^2,k,n);
  486. 2*(2*n - 1)*summ(n - 1) - summ(n)*n
  487. sumrecursion(factorial(a+k)*factorial(b+k)*factorial(n+c-a-b-k-1)/(
  488. factorial(k+1)*factorial(n-k)*factorial(k+c)),k,a);
  489. - (n + 1 + c - a)*(b - c + a)*summ(a) + (a - c)*(a - 1)*summ(a - 1)
  490. % sumrecursion(factorial(a+k)*factorial(b+k)*factorial(n+c-a-b-k-1)/(
  491. % factorial(k+1)*factorial(n-k)*factorial(k+c)),k,b);
  492. % sumrecursion(factorial(a+k)*factorial(b+k)*factorial(n+c-a-b-k-1)/(
  493. % factorial(k+1)*factorial(n-k)*factorial(k+c)),k,c);
  494. sumrecursion(binomial(2*n+1,2*p+2*k+1)*binomial(p+k,k),k,n);
  495. (2*p + 1 - 2*n)*(n - p)*summ(n) - 2*(p + 1 - 2*n)*(2*n - p)*summ(n - 1)
  496. % sumrecursion(binomial(2*n+1,2*p+2*k+1)*binomial(p+k,k),k,p);
  497. sumrecursion(binomial(r,m)*binomial(s,t-m),m,r);
  498. (s - t + r)*summ(r) - (r + s)*summ(r - 1)
  499. % sumrecursion(binomial(r,m)*binomial(s,t-m),m,s);
  500. % sumrecursion(binomial(r,m)*binomial(s,t-m),m,t);
  501. sumrecursion(binomial(2*n+1,2*k)*binomial(m+k,2*n),k,n);
  502. (2*n - 3 - 2*m)*(n - 1 - m)*summ(n - 1) - (2*n - 1)*summ(n)*n
  503. % sumrecursion(binomial(2*n+1,2*k)*binomial(m+k,2*n),k,m);
  504. sumrecursion(binomial(n,k)*binomial(k,j)*x^j,k,n);
  505. (j - n)*summ(n) + 2*summ(n - 1)*n
  506. % sumrecursion(binomial(n,k)*binomial(k,j)*x^j,k,j);
  507. % sumrecursion(binomial(n,k)*binomial(k,j)*x^k,k,n);
  508. sumrecursion(x*binomial(n+k,2*k)*((x^2-1)/4)^(n-k),k,n);
  509. 2 2 2
  510. - ((x + 1) *(x - 1) *summ(n - 2) + 16*summ(n)) + 8*(x + 1)*summ(n - 1)
  511. sumrecursion(binomial(n+k-1,2*k-1)*(x-1)^(2*k)*x^(n-k)/k,k,n);
  512. 2 2
  513. - ((n - 2)*summ(n - 2)*x + summ(n)*n) + (n - 1)*(x + 1)*summ(n - 1)
  514. sumrecursion(
  515. 1/(k+1)*binomial(2*k,k)/(n-k+1)*binomial(2*n-2*k,n-k),k,n);
  516. summ(n - 1) + summ(n)
  517. sumrecursion(binomial(m,r)*binomial(n-r,n-r-q)*(t-1)^r,r,m);
  518. (t + 1 + n*t - (t - 1)*q - (t + 1)*m)*summ(m - 1)
  519. - ((n + 1 - m)*summ(m) - (m - 1)*summ(m - 2)*t)
  520. % sumrecursion(binomial(m,r)*binomial(n-r,n-r-q)*(t-1)^r,r,n);
  521. % sumrecursion(binomial(m,r)*binomial(n-r,n-r-q)*(t-1)^r,r,q);
  522. % sumrecursion(binomial(m,r)*binomial(n-r,n-r-q)*(t-1)^r,r,r);
  523. sumrecursion(pochhammer(-n/2,k)*pochhammer(-n/2+1/2,k)/
  524. (factorial(k)*pochhammer(b+1/2,k)),k,n);
  525. (n - 1 + 2*b)*summ(n) - 2*(n - 1 + b)*summ(n - 1)
  526. % Watson
  527. % sumrecursion(pochhammer(a,k)*pochhammer(b,k)*pochhammer(c,k)/(
  528. % factorial(k)*pochhammer(1/2*(a+b+1),k)*pochhammer(2*c,k)),k,c);
  529. % sumrecursion(pochhammer(-m,j)*pochhammer(m+2*k+2,j)*pochhammer(k+1/2,j)/
  530. % (factorial(j)*pochhammer(k+3/2,j)*pochhammer(2*k+1,j)),j,k);
  531. sumrecursion((-1)^k*binomial(n,k)^3,k,n);
  532. 2
  533. 3*(3*n - 2)*(3*n - 4)*summ(n - 2) + summ(n)*n
  534. % sumrecursion(pochhammer(-n,k)*pochhammer(n+2*a,k)*pochhammer(a,k)/(
  535. % factorial(k)*pochhammer(2*a/2,k)*pochhammer((2*a+1)/2,k))*(2/4)^k,k,n);
  536. % sumrecursion(pochhammer(-n,k)*pochhammer(n+4*a,k)*pochhammer(a,k)/(
  537. % factorial(k)*pochhammer(4*a/2,k)*pochhammer((4*a+1)/2,k))*(4/4)^k,k,n);
  538. % sumrecursion(binomial(n+k+1,n-k)*pochhammer(-n+k,j)*pochhammer(k+1/2,j)*
  539. % pochhammer(n+k+2,j)/(factorial(j)*pochhammer(k+3/2,j)*
  540. % pochhammer(2*k+1,j)),j,n);
  541. % sumrecursion(pochhammer(-m,j)*pochhammer(m+2*k+2,j)*
  542. % pochhammer(k+1/2,j)/(
  543. % factorial(j)*pochhammer(k+3/2,j)*pochhammer(2*k+1,j)),j,m);
  544. % sumrecursion(binomial(n+k+1,n-k)*pochhammer(-n+k,j)*
  545. % pochhammer(k+1/2,j)*
  546. % pochhammer(n+k+2,j)/(factorial(j)*pochhammer(k+3/2,j)*
  547. % pochhammer(2*k+1,j)),
  548. % j,k);
  549. % sumrecursion(pochhammer(a+b+c-n,j+l)*pochhammer(a+b-n/2,j+l)/
  550. % (factorial(j)*factorial(l)*pochhammer(a-n/2+1,j)*
  551. % pochhammer(b-n/2+1,l)),j,a);
  552. % sumrecursion(pochhammer(a+b+c-n,j+l)*pochhammer(a+b-n/2,j+l)/
  553. % (factorial(j)*factorial(l)*pochhammer(a-n/2+1,j)*
  554. % pochhammer(b-n/2+1,l)),j,b);
  555. sumrecursion(pochhammer(a+b+c-n,j+l)*pochhammer(a+b-n/2,j+l)/
  556. (factorial(j)*factorial(l)*pochhammer(a-n/2+1,j)*
  557. pochhammer(b-n/2+1,l)),j,c);
  558. - (n + 1 - l - c - b - a)*(n + 2 - 2*l - 2*c - 2*b)*summ(c - 1)
  559. + 2*(n + 1 - 2*l - c - 2*b - a)*(n + 1 - c - b - a)*summ(c)
  560. % sumrecursion(
  561. % (-1)^(a+b+c)*gamma(a+b+c-d/2)*gamma(d/2-c)*gamma(a+c-d/2)*
  562. % gamma(b+c-d/2)/
  563. % (gamma(a)*gamma(b)*gamma(d/2)*gamma(a+b+2*c-d)*(m^2)^(a+b+c-d))*
  564. % pochhammer(a+b+c-d,k)*pochhammer(a+c-d/2,k)/
  565. % (pochhammer(a+b+2*c-d,k)*factorial(k)),k,a);
  566. % sumrecursion(
  567. % (-1)^(a+b+c)*gamma(a+b+c-d/2)*gamma(d/2-c)*gamma(a+c-d/2)*
  568. % gamma(b+c-d/2)/
  569. % (gamma(a)*gamma(b)*gamma(d/2)*gamma(a+b+2*c-d)*(m^2)^(a+b+c-d))*
  570. % pochhammer(a+b+c-d,k)*pochhammer(a+c-d/2,k)/
  571. % (pochhammer(a+b+2*c-d,k)*factorial(k)),k,b);
  572. % sumrecursion(
  573. % (-1)^(a+b+c)*gamma(a+b+c-d/2)*gamma(d/2-c)*gamma(a+c-d/2)*
  574. % gamma(b+c-d/2)/
  575. % (gamma(a)*gamma(b)*gamma(d/2)*gamma(a+b+2*c-d)*(m^2)^(a+b+c-d))*
  576. % pochhammer(a+b+c-d,k)*pochhammer(a+c-d/2,k)/
  577. % (pochhammer(a+b+2*c-d,k)*factorial(k)),k,c);
  578. % sumrecursion(pochhammer(-n,k)*pochhammer(n+3*a,k)*pochhammer(a,k)/(
  579. % factorial(k)*pochhammer(3*a/2,k)*
  580. % pochhammer((3*a+1)/2,k))*(3/4)^k,k,n);
  581. % summand:=k*(-1)^j*pochhammer(2*k+j+1,j)*pochhammer(2*k+2*j+2,n-k-j)/(
  582. % factorial(k+j)*factorial(j)*factorial(n-k-j))*exp(-(j+k)*t)$
  583. % summand:=k*(-1)^j*pochhammer(2*k+j+1,j)*pochhammer(2*k+2*j+2,n-k-j)/(
  584. % (k+j)*factorial(j)*factorial(n-k-j))*exp(-(j+k)*t)$
  585. % sumrecursion(summand,j,n);
  586. clear(summand);
  587. % 6) Finding recurrence equations for hypergeometric functions
  588. % Koornwinder, T. H.:
  589. % On Zeilberger's algorithm and
  590. % its q-analogue: a rigorous description.
  591. % J. of Comput. and Appl. Math. 48, 1993, 91-111.
  592. % Gauss
  593. hyperrecursion({a,b},{c},1,a);
  594. (b - c + a)*summ(a) - (a - c)*summ(a - 1)
  595. % Dougall
  596. % hyperrecursion({d,1+d/2,d+b-a,d+c-a,1+a-b-c,n+a,-n},
  597. % {d/2,1+a-b,1+a-c,b+c+d-a,1+d-a-n,1+d+n},1,n);
  598. % Baxter
  599. % hyperrecursion({-n,-n-1,-n-2},{2,3},-1,n);
  600. % Krawtchouk polynomials
  601. % krawtchoukterm :=
  602. % (-1)^n*p^n*binomial(NN,n)*hyperterm({-n,-x},{-NN},1/p,k)$
  603. % sumrecursion(krawtchoukterm,k,n);
  604. % sumrecursion(krawtchoukterm,k,x);
  605. % sumrecursion(krawtchoukterm,k,NN);
  606. % clear(krawtchoukterm);
  607. % hyperrecursion({-n,b,c+4},{b+1,c},1,n);
  608. hyperrecursion({-n,b,c+1,d+1},{b+1,c,d},1,n);
  609. recursion valid for n>=3
  610. (b + n)*summ(n) - summ(n - 1)*n
  611. % 7) Extended versions of Gosper's and Zeilberger's algorithms
  612. % Koepf, W.:
  613. % Algorithms for the indefinite and definite summation.
  614. % Konrad-Zuse-Zentrum Berlin (ZIB), Preprint SC 94-33, 1994.
  615. % extended Gosper algorithm
  616. extended_gosper(k*factorial(k/7),k,7);
  617. k
  618. (k + 7)*factorial(---)
  619. 7
  620. extended_gosper(k*factorial(k/2),k,2);
  621. k
  622. (k + 2)*factorial(---)
  623. 2
  624. extended_gosper(k*factorial(k/2),k);
  625. k k - 1
  626. (k + 2)*factorial(---) + (k + 1)*factorial(-------)
  627. 2 2
  628. extended_gosper(binomial(k/2,n),k);
  629. k k - 1
  630. (k + 2)*binomial(---,n) + (k + 1)*binomial(-------,n)
  631. 2 2
  632. -------------------------------------------------------
  633. 2*(n + 1)
  634. extended_gosper(binomial(n,k/2)-binomial(n,k/2-1),k);
  635. k - 3 k - 1
  636. ( - ((2*n + 3 - k)*(n + 1 - k)*(binomial(n,-------) - binomial(n,-------))
  637. 2 2
  638. k - 2 k
  639. + (n + 2 - k)*(2*(n + 1) - k)*(binomial(n,-------) - binomial(n,---))))/(2
  640. 2 2
  641. *(n + 2 - k)*(n + 1 - k))
  642. % extended Zeilberger algorithm
  643. % extended_sumrecursion(binomial(n,k)*binomial(k/2,n),k,n,1,2);
  644. sumrecursion(binomial(n,k)*binomial(k/2,n),k,n);
  645. recursion valid for n>=3
  646. summ(n - 1) + 2*summ(n)
  647. extended_sumrecursion(binomial(n/2,k),k,n,2,1);
  648. 2*summ(n - 2) - summ(n)
  649. sumrecursion(binomial(n/2,k),k,n);
  650. 2*summ(n - 2) - summ(n)
  651. % sumrecursion(hyperterm({a,b,a+1/2-b,1+2*a/3,-n},
  652. % {2*a+1-2*b,2*b,2/3*a,1+a+n/2},4,k)/
  653. % (factorial(n)*2^(-n)/factorial(n/2))/
  654. % hyperterm({a+1,1},{a-b+1,b+1/2},1,n/2),k,n);
  655. % Watson
  656. % sumrecursion(pochhammer(a,k)*pochhammer(b,k)*pochhammer(c,k)/(
  657. % factorial(k)*pochhammer(1/2*(a+b+1),k)*pochhammer(2*c,k))/
  658. % (GAMMA(1/2)*GAMMA(1/2+c)*GAMMA(1/2+a/2+b/2)*GAMMA(1/2-a/2-b/2+c))*
  659. % GAMMA(1/2+a/2)*GAMMA(1/2+b/2)*GAMMA(1/2-a/2+c)*GAMMA(1/2-b/2+c),k,a);
  660. % hyperrecursion({a,b,c},{1/2*(a+b+1),2*c},1,a);
  661. % hyperrecursion({a,b,c},{1/2*(a+b+1),2*c},1,b);
  662. % 8) Closed form representations of hypergeometric sums
  663. % Vandermonde
  664. hypersum({-n,b},{c},1,n);
  665. pochhammer( - b + c,n)
  666. ------------------------
  667. pochhammer(c,n)
  668. % Saalschuetz
  669. hypersum({a,b,-n},{c,1+a+b-c-n},1,n);
  670. pochhammer( - a + c,n)*pochhammer( - b + c,n)
  671. -----------------------------------------------
  672. pochhammer( - a - b + c,n)*pochhammer(c,n)
  673. % Kummer
  674. hypersum({a,-n},{1+a+n},-1,n);
  675. pochhammer(a + 1,n)
  676. -----------------------
  677. a + 2
  678. pochhammer(-------,n)
  679. 2
  680. % Dixon
  681. hypersum({a,b,-n},{1+a-b,1+a+n},1,n);
  682. a - 2*b + 2
  683. pochhammer(a + 1,n)*pochhammer(-------------,n)
  684. 2
  685. -------------------------------------------------
  686. a + 2
  687. pochhammer(a - b + 1,n)*pochhammer(-------,n)
  688. 2
  689. % Dougall
  690. % hypersum({a,1+a/2,b,c,d,1+2*a-b-c-d+n,-n},
  691. % {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);
  692. % Clausen
  693. % hypersum({a,b,1/2-a-b-n,-n},{1/2+a+b,1-a-n,1-b-n},1,n);
  694. hypersum({a,1+a/2,c,d,-n},{a/2,1+a-c,1+a-d,1+a+n},1,n);
  695. pochhammer(a - c - d + 1,n)*pochhammer(a + 1,n)
  696. -------------------------------------------------
  697. pochhammer(a - c + 1,n)*pochhammer(a - d + 1,n)
  698. hypersum({a,1+a/2,d,-n},{a/2,1+a-d,1+a+n},-1,n);
  699. pochhammer(a + 1,n)
  700. -------------------------
  701. pochhammer(a - d + 1,n)
  702. % m-fold case:
  703. hypersum({-n,-n,-n},{1,1},1,n);
  704. n/2 2 n 1 n
  705. ( - 27) *pochhammer(---,---)*pochhammer(---,---)
  706. 3 2 3 2
  707. {----------------------------------------------------,
  708. n 2
  709. factorial(---)
  710. 2
  711. 0}
  712. % hypersum({-n,n+3*a,a},{3*a/2,(3*a+1)/2},3/4,n);
  713. % 9) Hypergeometric representations
  714. sumtohyper(binomial(n,k)^3,k);
  715. hypergeom({ - n, - n, - n},{1,1},-1)
  716. sumtohyper(binomial(n,k)/2^n-sub(n=n-1,binomial(n,k)/2^n),k);
  717. - n + 2 - n
  718. - hypergeom({----------, - n},{------},-1)
  719. 2 2
  720. ---------------------------------------------
  721. n
  722. 2
  723. sumtohyper(binomial(k+j-1,k-j)*2*(-1)^(j+1)*factorial(2*j-1)/
  724. factorial(j-1)/factorial(j+1)*x^j,j);
  725. hypergeom({k + 1, - k + 1},{3},x)*k*x
  726. % term:=1/(n-1+k)*(1/2-1/2*x)^k/n*binomial(k-n-1,-n-1)*k*
  727. % binomial(n-1+k,n-1);
  728. % sumtohyper(sub(n=n+1,term)-term,k);
  729. end;
  730. (TIME: zeilberg 141560 147540)