ZEILBERG.TEX 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271
  1. \documentstyle[11pt,reduce]{article}
  2. \title{{\tt ZEILBERG}\\
  3. A Package for the Indefinite\\
  4. and Definite Summation}
  5. \date{}
  6. \author{Wolfram Koepf\\
  7. Gregor St\"olting \\
  8. ZIB Berlin \\
  9. email: {\tt Koepf@ZIB-Berlin.de}
  10. }
  11. \begin{document}
  12. \maketitle
  13. \newcommand{\N} {{\rm {\mbox{\protect\makebox[.15em][l]{I}N}}}}
  14. \newcommand{\funkdef}[3]{\left\{\!\!\!\begin{array}{cc}
  15. #1 & \!\!\!\mbox{\rm{if} $#2$ } \\
  16. #3 & \!\!\!\mbox{\rm{otherwise}}
  17. \end{array}
  18. \right.}
  19. \section{Introduction}
  20. This package is a careful implementation of the Gosper%
  21. \footnote{The {\tt sum} package contains also a partial implementation
  22. of the Gosper algorithm.}
  23. and Zeilberger algorithms for indefinite, and definite summation of
  24. hypergeometric terms, respectively. Further, extensions of these algorithms
  25. given by the first author are covered. An expression $a_k$ is called a
  26. {\sl hypergeometric term} (or {\sl closed form}),
  27. if $a_{k}/a_{k-1}$ is a rational function with respect to $k$.
  28. Typical hypergeometric terms are ratios of products of powers, factorials,
  29. $\Gamma$ function terms, binomial coefficients, and shifted factorials
  30. (Pochhammer symbols) that are integer-linear in their arguments.
  31. The extensions of Gosper's and Zeilberger's algorithm mentioned
  32. in particular are valid for ratios of products of powers, factorials,
  33. $\Gamma$ function terms, binomial coefficients, and shifted factorials
  34. that are rational-linear in their arguments.
  35. \section{Gosper Algorithm}
  36. The Gosper algorithm \cite{Gos} is a {\sl decision procedure}, that
  37. decides by algebraic calculations whether or not a given hypergeometric term
  38. $a_k$ has a hypergeometric term antidifference $g_k$, i.\ e.\
  39. $g_{k}-g_{k-1}=a_k$ with rational $g_k/g_{k-1}$,
  40. and returns $g_k$ if the procedure is successful, in which
  41. case we call $a_k$ {\sl Gosper-summable}. Otherwise
  42. {\sl no hypergeometric term antidifference exists}. Therefore
  43. if the Gosper algorithm does not return a closed form solution,
  44. it has {\sl proved} that no such solution exists, an information
  45. that may be quite useful and important.
  46. The Gosper algorithm is the discrete analogue of the Risch algorithm
  47. for integration in terms of elementary functions.
  48. Any antidifference is uniquely determined up to a constant, and is
  49. denoted by
  50. \[
  51. g_k=\sum\nolimits_k a_k
  52. \;.
  53. \]
  54. Finding $g_k$ given $a_k$ is called {\sl indefinite summation}.
  55. The antidifference operator $\Sigma$ is the inverse of the downward
  56. difference operator $\nabla a_k=a_{k}-a_{k-1}$. There is an analogous
  57. summation theory corresponding to the upward difference operator
  58. $\Delta a_k=a_{k+1}-a_k$.
  59. In case, an antidifference $g_k$ of $a_k$ is known, any sum
  60. \[
  61. \sum_{k=m}^{n} a_k=g_{n}-g_{m-1}
  62. \]
  63. can be easily calculated by an evaluation of $g$ at the boundary points
  64. like in the integration case. Note, however, that the sum
  65. \begin{equation}
  66. \sum_{k=0}^n {{n}\choose{k}}
  67. \label{eq:nchoosek}
  68. \end{equation}
  69. e.\ g.\
  70. is not of this type since the summand ${{n}\choose{k}}$ depends on the upper
  71. boundary point $n$ explicitly. This is an example of a definite sum
  72. that we consider in the next section.
  73. Our package supports the input of powers ({\tt a\verb+^+k)},
  74. factorials ({\tt factorial(k)}),
  75. $\Gamma$ function terms ({\tt gamma(a)}), binomial coefficients
  76. ({\tt binomial(n,k)}), shifted factorials
  77. ({\tt pochhammer(a,k)$=a(a+1)\cdots(a+k-1)=\Gamma (a+k)/\Gamma (a)$}), and
  78. partially products ({\tt prod(f,k,k1,k2)}).
  79. It takes care of the necessary simplifications, and therefore
  80. provides you with the solution of the decision problem
  81. as long as the memory or time requirements are not too high for the
  82. computer used.
  83. \section{Zeilberger Algorithm}
  84. The (fast) Zeilberger algorithm \cite{Zei2}--\cite{Zei3}
  85. deals with the {\sl definite summation} of
  86. hypergeometric terms. Zeilberger's paradigm is to find (and return)
  87. a linear homogeneous recurrence equation with polynomial coefficients
  88. (called {\sl holonomic equation}) for an {\sl infinite sum}
  89. \[
  90. s(n)=\sum_{k=-\infty}^{\infty} f(n,k)
  91. \;,
  92. \]
  93. the summation to be understood over all integers $k$,
  94. if $f(n,k)$ is a hypergeometric term with respect to both $k$ and $n$.
  95. The existence of a holonomic recurrence equation for $s(n)$ is then
  96. generally guaranteed.
  97. If one is lucky, and the resulting recurrence equation is of first order
  98. \[
  99. p(n)\,s(n-1)+q(n)\,s(n)=0
  100. \quad\quad(p,q\;\mbox{polynomials})
  101. \;,
  102. \]
  103. $s(n)$ turns out to be a hypergeometric term, and a closed form solution
  104. can be easily established using a suitable initial value, and is
  105. represented by a ratio of Pochhammer or $\Gamma$ function terms if the
  106. polynomials $p$, and $q$ can be factored.
  107. Zeilberger's algorithm does not guarantee to find the holonomic equation
  108. of lowest order, but often it does.
  109. If the resulting recurrence equation has order larger than one,
  110. this information can be used for identification purposes:
  111. Any other expression satisfying the same recurrence equation, and the same
  112. initial values, represents the same function.
  113. Note that a {\sl definite sum} $\sum\limits_{k=m_1}^{m_2} f(n,k)$ is an
  114. infinite sum if $f(n,k)=0$ for $k<m_1$ and $k>m_2$.
  115. This is often the case, an example of which is the sum (\ref{eq:nchoosek})
  116. considered above, for which the hypergeometric recurrence equation
  117. $2 s(n-1) - s(n) = 0$ is generated by Zeilberger's algorithm, leading
  118. to the closed form solution $s(n)=2^n$.
  119. Definite summation is trivial if the corresponding indefinite sum
  120. is Gosper-summable analogously to the fact that definite integration
  121. is trivial as soon as an elementary antiderivative is known. If this is
  122. not the case, the situation is much more difficult, and it is therefore
  123. quite remarkable and non-obvious
  124. that Zeilberger's method is just a clever application of Gosper's algorithm.
  125. Our implementation is mainly based on \cite{Koornwinder} and \cite{Koepf}.
  126. More examples can be found in \cite{PS}, \cite{Strehl2}, \cite{Wil1},
  127. and \cite{Wilf} many of which are contained in the test file
  128. {\tt zeilberg.tst}.
  129. \section{\REDUCE{} operator {\tt GOSPER}}
  130. The ZEILBERG package must be loaded by:
  131. {\small
  132. \begin{verbatim}
  133. 1: load zeilberg;
  134. \end{verbatim}
  135. }\noindent
  136. The {\tt gosper} operator is an implementation of the Gosper algorithm.
  137. \begin{itemize}
  138. \item
  139. {\tt gosper(a,k)} determines a closed
  140. form antidifference. If it does not return a closed form solution, then
  141. a closed form solution does not exist.
  142. \item
  143. {\tt gosper(a,k,m,n)} determines
  144. \[
  145. \sum_{k=m}^n a_k
  146. \]
  147. using Gosper's algorithm. This is only successful if Gosper's algorithm applies.
  148. \end{itemize}
  149. Example:
  150. {\small
  151. \begin{verbatim}
  152. 2: gosper((-1)^(k+1)*(4*k+1)*factorial(2*k)/
  153. (factorial(k)*4^k*(2*k-1)*factorial(k+1)),k);
  154. k
  155. - ( - 1) *factorial(2*k)
  156. ------------------------------------
  157. 2*k
  158. 2 *factorial(k + 1)*factorial(k)
  159. \end{verbatim}
  160. }\noindent
  161. This solves a problem given in SIAM Review (\cite{SR}, Problem 94--2)
  162. where it was asked to determine the infinite sum
  163. \[
  164. S=\lim_{n\rightarrow\infty} S_n
  165. \;,
  166. \quad\quad\quad
  167. S_n=\sum_{k=1}^n
  168. \frac{(-1)^{k+1}(4k+1)(2k-1)!!}{2^k(2k-1)(k+1)!}
  169. \;,
  170. \]
  171. ($(2k-1)!!=1\cdot 3 \cdots (2k-1)=\frac{(2k)!}{2^k\,k!}$).
  172. The above calculation shows that the summand is Gosper-summable,
  173. and the limit $S=1$ is easily established using Stirling's formula.
  174. The implementation solves further deep and difficult problems some examples of
  175. which are:%
  176. {\small
  177. \begin{verbatim}
  178. 3: gosper(sub(n=n+1,binomial(n,k)^2/binomial(2*n,n))-
  179. binomial(n,k)^2/binomial(2*n,n),k);
  180. 2
  181. ((binomial(n + 1,k) *binomial(2*n,n)
  182. 2
  183. - binomial(2*(n + 1),n + 1)*binomial(n,k) )*(2*k - 3*n - 1)
  184. 2 3 2
  185. *(k - n - 1) )/((2*(2*(n + 1) - k)*(2*n + 1)*k - 3*n - 7*n - 5*n
  186. - 1)*binomial(2*(n + 1),n + 1)*binomial(2*n,n))
  187. 4: gosper(binomial(k,n),k);
  188. (k + 1)*binomial(k,n)
  189. -----------------------
  190. n + 1
  191. 5: gosper((-25+15*k+18*k^2-2*k^3-k^4)/
  192. (-23+479*k+613*k^2+137*k^3+53*k^4+5*k^5+k^6),k);
  193. 2
  194. - (2*k - 15*k + 8)*k
  195. ----------------------------
  196. 3 2
  197. 23*(k + 4*k + 27*k + 23)
  198. \end{verbatim}
  199. }\noindent
  200. The Gosper algorithm is not capable to give antidifferences depending
  201. on the harmonic numbers
  202. \[
  203. H_k:=\sum_{j=1}^k\frac{1}{j}
  204. \;,
  205. \]
  206. e.\ g.\ $\sum_k H_k=(k+1)(H_{k+1}-1)$, but, is able to give a proof, instead,
  207. for the fact that $H_k$ does not possess a closed form evaluation:
  208. {\small
  209. \begin{verbatim}
  210. 6: gosper(1/k,k);
  211. ***** Gosper algorithm: no closed form solution exists
  212. \end{verbatim}
  213. }\noindent
  214. The following code gives the solution to a summation problem proposed in
  215. Gosper's original paper \cite{Gos}. Let
  216. \[
  217. f_k=\prod_{j=1}^k (a+b\,j+c\,j^2)
  218. \quad\quad\mbox{and}\quad\quad
  219. g_k=\prod_{j=1}^k (e+b\,j+c\,j^2)
  220. \;.
  221. \]
  222. Then a closed form solution for
  223. \[
  224. \sum\nolimits_k\frac{f_{k-1}}{g_{k}}
  225. \]
  226. is found by the definitions
  227. {\small
  228. \begin{verbatim}
  229. 7: operator ff,gg$
  230. 8: let {ff(~k+~m) => ff(k+m-1)*(c*(k+m)^2+b*(k+m)+a)
  231. when (fixp(m) and m>0),
  232. ff(~k+~m) => ff(k+m+1)/(c*(k+m+1)^2+b*(k+m+1)+a)
  233. when (fixp(m) and m<0)}$
  234. 9: let {gg(~k+~m) => gg(k+m-1)*(c*(k+m)^2+b*(k+m)+e)
  235. when (fixp(m) and m>0),
  236. gg(~k+~m) => gg(k+m+1)/(c*(k+m+1)^2+b*(k+m+1)+e)
  237. when (fixp(m) and m<0)}$
  238. \end{verbatim}
  239. }\noindent
  240. and the calculation
  241. {\small
  242. \begin{verbatim}
  243. 10: gosper(ff(k-1)/gg(k),k);
  244. ff(k)
  245. ---------------
  246. (a - e)*gg(k)
  247. 11: clear ff,gg$
  248. \end{verbatim}
  249. }\noindent
  250. Similarly closed form solutions of $\sum\nolimits_k\frac{f_{k-m}}{g_{k}}$
  251. for positive integers $m$ can be obtained, as well as of
  252. $\sum_k\frac{f_{k-1}}{g_{k}}$ for
  253. \[
  254. f_k=\prod_{j=1}^k (a+b\,j+c\,j^2+d\,j^3)
  255. \quad\quad\mbox{and}\quad\quad
  256. g_k=\prod_{j=1}^k (e+b\,j+c\,j^2+d\,j^3)
  257. \]
  258. and for analogous expressions of higher degree polynomials.
  259. \section{\REDUCE{} operator {\tt EXTENDED\_GOSPER}}
  260. The {\tt extended\verb+_+gosper} operator is an implementation of an extended
  261. version of Gosper's algorithm given by Koepf \cite{Koepf}.
  262. \begin{itemize}
  263. \item
  264. {\tt extended\verb+_+gosper(a,k)} determines an antidifference $g_k$ of $a_k$
  265. whenever there is a number $m$ such that $h_{k}-h_{k-m}=a_k$, and $h_k$ is an
  266. {\sl $m$-fold hypergeometric term}, i.\ e.
  267. \[
  268. h_{k}/h_{k-m}\quad\mbox{is a rational function with respect to $k$.}
  269. \]
  270. If it does not return a solution, then such a solution does not exist.
  271. \item
  272. {\tt extended\verb+_+gosper(a,k,m)}
  273. determines an {\sl $m$-fold antidifference} $h_k$ of $a_k$,
  274. i.\ e.\ $h_{k}-h_{k-m}=a_k$, if it is an $m$-fold hypergeometric term.
  275. \end{itemize}
  276. Examples:
  277. {\small
  278. \begin{verbatim}
  279. 12: extended_gosper(binomial(k/2,n),k);
  280. k k - 1
  281. (k + 2)*binomial(---,n) + (k + 1)*binomial(-------,n)
  282. 2 2
  283. -------------------------------------------------------
  284. 2*(n + 1)
  285. 13: extended_gosper(k*factorial(k/7),k,7);
  286. k
  287. (k + 7)*factorial(---)
  288. 7
  289. \end{verbatim}
  290. }\noindent
  291. \section{\REDUCE{} operator {\tt SUMRECURSION}}
  292. The {\tt sumrecursion} operator is an implementation of the (fast)
  293. Zeilberger algorithm.
  294. \begin{itemize}
  295. \item
  296. {\tt sumrecursion(f,k,n)} determines a holonomic recurrence equation
  297. for
  298. \[
  299. {\tt sum(n)} =\sum\limits_{k=-\infty}^\infty f(n,k)
  300. \]
  301. with respect to $n$, applying
  302. {\tt extended\verb+_+sumrecursion} if necessary,
  303. see \S~\ref{sec:EXTENDED_SUMRECURSION}.
  304. The resulting expression equals zero.
  305. \item
  306. {\tt sumrecursion(f,k,n,j)} % $(j\in\N)$
  307. searches for a holonomic recurrence equation of order $j$. This
  308. operator does not use {\tt extended\verb+_+sumrecursion} automatically.
  309. Note that if $j$ is too large, the recurrence equation
  310. may not be unique, and only one particular solution is returned.
  311. \end{itemize}
  312. A simple example deals with Equation (\ref{eq:nchoosek})%
  313. \footnote{Note that with \REDUCE{} Version 3.5 we use the global operator
  314. {\tt summ} instead of {\tt sum} to denote the sum.}
  315. {\small
  316. \begin{verbatim}
  317. 14: sumrecursion(binomial(n,k),k,n);
  318. 2*sum(n - 1) - sum(n)
  319. \end{verbatim}
  320. }\noindent
  321. The whole {\sl hypergeometric database} of the {\sl
  322. Vandermonde, Gau{\ss}, Kummer, Saalsch\"utz, Dixon, Clausen} and {\sl Dougall
  323. identities} (see \cite{Wilf}), and many more identities (see e.\ g.\
  324. \cite{Koepf}), can be obtained using {\tt sumrecursion}.
  325. As examples, we consider the difficult cases of Clausen and Dougall:%
  326. {\small
  327. \begin{verbatim}
  328. 15: summand:=factorial(a+k-1)*factorial(b+k-1)/(factorial(k)*
  329. factorial(-1/2+a+b+k))*factorial(a+n-k-1)*factorial(b+n-k-1)/
  330. (factorial(n-k)*factorial(-1/2+a+b+n-k))$
  331. 16: sumrecursion(summand,k,n);
  332. (2*a + 2*b + 2*n - 1)*(2*a + 2*b + n - 1)*sum(n)*n
  333. - 2*(2*a + n - 1)*(a + b + n - 1)*(2*b + n - 1)*sum(n - 1)
  334. 17: summand:=pochhammer(d,k)*pochhammer(1+d/2,k)*pochhammer(d+b-a,k)*
  335. pochhammer(d+c-a,k)*pochhammer(1+a-b-c,k)*pochhammer(n+a,k)*
  336. pochhammer(-n,k)/(factorial(k)*pochhammer(d/2,k)*
  337. pochhammer(1+a-b,k)*pochhammer(1+a-c,k)*pochhammer(b+c+d-a,k)*
  338. pochhammer(1+d-a-n,k)*pochhammer(1+d+n,k))$
  339. 18: sumrecursion(summand,k,n);
  340. (2*a - b - c - d + n)*(b + n - 1)*(c + n - 1)*(d + n)*sum(n - 1) +
  341. (a - b - c - d - n + 1)*(a - b + n)*(a - c + n)*(a - d + n - 1)
  342. *sum(n)
  343. \end{verbatim}
  344. }\noindent
  345. corresponding to the statements
  346. \[
  347. _4 F_3\left.
  348. \!\!
  349. \left(
  350. \!\!\!\!
  351. \begin{array}{c}
  352. \multicolumn{1}{c}{\begin{array}{c}
  353. a\;, b\;, 1/2-a-b-n\;, -n
  354. \end{array}}\\[1mm]
  355. \multicolumn{1}{c}{\begin{array}{c}
  356. 1/2+a+b \;, 1-a-n\;, 1-b-n
  357. \end{array}}\end{array}
  358. \!\!\!\!
  359. \right| 1\right)
  360. =\frac{(2a)_n\,(a+b)_n\,(2b)_n}
  361. {(2a+2b)_n\,(a)_n\,(b)_n}
  362. \]
  363. and
  364. \[
  365. _7 F_6\left.
  366. \!\!
  367. \left(
  368. \!\!\!\!
  369. \begin{array}{c}
  370. \multicolumn{1}{c}{\begin{array}{c}
  371. d\;, 1+d/2\;, d+b-a\;, d+c-a\;, 1+a-b-c\;, n+a\;, -n
  372. \end{array}}\\[1mm]
  373. \multicolumn{1}{c}{\begin{array}{c}
  374. d/2\;, 1+a-b\;, 1+a-c\;, b+c+d-a \;, 1+d-a-n\;, 1+d+n
  375. \end{array}}\end{array}
  376. \!\!\!\!
  377. \right| 1\right)
  378. \]
  379. \[
  380. =\frac{(d+1)_n\,(b)_n\,(c)_n\,(1+2\,a-b-c-d)_n}
  381. {(a-d)_n\,(1+a-b)_n\,(1+a-c)_n\,(b+c+d-a)_n}
  382. \]
  383. (compare next section), respectively.
  384. Other applications of the Zeilberger algorithm are connected with
  385. the verification of identities. To prove the identity
  386. \[
  387. \sum_{k=0}^n
  388. {{n}\choose{k}}^3
  389. =
  390. \sum_{k=0}^n
  391. {{n}\choose{k}}^2 {{2k}\choose{n}}
  392. \;,
  393. \]
  394. e.\ g., we may prove that both sums satisfy the same recurrence equation
  395. {\small
  396. \begin{verbatim}
  397. 19: sumrecursion(binomial(n,k)^3,k,n);
  398. 2 2 2
  399. (7*n - 7*n + 2)*sum(n - 1) + 8*(n - 1) *sum(n - 2) - sum(n)*n
  400. 20: sumrecursion(binomial(n,k)^2*binomial(2*k,n),k,n);
  401. 2 2 2
  402. (7*n - 7*n + 2)*sum(n - 1) + 8*(n - 1) *sum(n - 2) - sum(n)*n
  403. \end{verbatim}
  404. }\noindent
  405. and finally check the initial conditions:
  406. {\small
  407. \begin{verbatim}
  408. 21: sub(n=0,k=0,binomial(n,k)^3);
  409. 1
  410. 22: sub(n=0,k=0,binomial(n,k)^2*binomial(2*k,n));
  411. 1
  412. 23: sub(n=1,k=0,binomial(n,k)^3)+sub(n=1,k=1,binomial(n,k)^3);
  413. 2
  414. 24: sub(n=1,k=0,binomial(n,k)^2*binomial(2*k,n))+
  415. sub(n=1,k=1,binomial(n,k)^2*binomial(2*k,n));
  416. 2
  417. \end{verbatim}
  418. }\noindent
  419. \section{\REDUCE{} operator {\tt EXTENDED\_SUMRECURSION}}
  420. \label{sec:EXTENDED_SUMRECURSION}
  421. The {\tt extended\verb+_+sumrecursion} operator is an implementation
  422. of an extension of the (fast) Zeilberger algorithm given by Koepf
  423. \cite{Koepf}.
  424. \begin{itemize}
  425. \item
  426. {\tt extended\verb+_+sumrecursion(f,k,n,m,l)} determines a holonomic recurrence
  427. equation for ${\tt sum(n)} =\sum\limits_{k=-\infty}^\infty f(n,k)$
  428. with respect to $n$ if $f(n,k)$ is an {\sl $(m,l)$-fold hypergeometric term}
  429. with respect to $(n,k)$, i.\ e.\
  430. \[
  431. \frac{F(n,k)}{F(n-m,k)}
  432. \quad
  433. \mbox{and}
  434. \quad
  435. \frac{F(n,k)}{F(n,k-l)}
  436. \]
  437. are rational functions with respect to both $n$ and $k$.
  438. The resulting expression equals zero.
  439. \item
  440. {\tt sumrecursion(f,k,n)} invokes {\tt extended\verb+_+sumrecursion(f,k,n,m,l)}
  441. with suitable values $m$ and $l$, and covers therefore the extended
  442. algorithm completely.
  443. \end{itemize}
  444. Examples:
  445. {\small
  446. \begin{verbatim}
  447. 25: extended_sumrecursion(binomial(n,k)*binomial(k/2,n),k,n,1,2);
  448. sum(n - 1) + 2*sum(n)
  449. \end{verbatim}
  450. }\noindent
  451. which can be obtained automatically by
  452. {\small
  453. \begin{verbatim}
  454. 26: sumrecursion(binomial(n,k)*binomial(k/2,n),k,n);
  455. sum(n - 1) + 2*sum(n)
  456. \end{verbatim}
  457. }\noindent
  458. Similarly, we get
  459. {\small
  460. \begin{verbatim}
  461. 27: extended_sumrecursion(binomial(n/2,k),k,n,2,1);
  462. 2*sum(n - 2) - sum(n)
  463. 28: sumrecursion(binomial(n/2,k),k,n);
  464. 2*sum(n - 2) - sum(n)
  465. 29: sumrecursion(hyperterm({a,b,a+1/2-b,1+2*a/3,-n},
  466. {2*a+1-2*b,2*b,2/3*a,1+a+n/2},4,k)/(factorial(n)*2^(-n)/
  467. factorial(n/2))/hyperterm({a+1,1},{a-b+1,b+1/2},1,n/2),k,n);
  468. sum(n - 2) - sum(n)
  469. \end{verbatim}
  470. }\noindent
  471. In the last example, the progam chooses $m=2$, and $l=1$ to derive the
  472. resulting recurrence equation (see \cite{Koepf}, Table 3, (1.3)).
  473. \section{\REDUCE{} operator {\tt HYPERRECURSION}}
  474. Sums to which the Zeilberger algorithm applies, in general are
  475. special cases of the {\sl generalized hypergeometric function}
  476. \[
  477. _{p}F_{q}\left.\left(\begin{array}{cccc}
  478. a_{1},&a_{2},&\cdots,&a_{p}\\
  479. b_{1},&b_{2},&\cdots,&b_{q}\\
  480. \end{array}\right| x\right)
  481. :=
  482. \sum_{k=0}^\infty \frac
  483. {(a_{1})_{k}\cdot(a_{2})_{k}\cdots(a_{p})_{k}}
  484. {(b_{1})_{k}\cdot(b_{2})_{k}\cdots(b_{q})_{k}\,k!}x^{k}
  485. \label{eq:coefficientformula}
  486. \]
  487. with upper parameters $\{a_{1}, a_{2}, \ldots, a_{p}\}$, and lower
  488. parameters $\{b_{1}, b_{2}, \ldots, b_{q}\}$. If a recursion for a
  489. generalized hypergeometric function is to be established, you can use
  490. the following \REDUCE{} operator:
  491. \begin{itemize}
  492. \item
  493. {\tt hyperrecursion(upper,lower,x,n)} determines a holonomic recurrence
  494. equation with respect to $n$ for
  495. $_{p}F_{q}\left.\left(\begin{array}{cccc}
  496. a_{1},&a_{2},&\cdots,&a_{p}\\
  497. b_{1},&b_{2},&\cdots,&b_{q}\\
  498. \end{array}\right| x\right)
  499. $, where {\tt upper}$=\{a_{1}, a_{2}, \ldots, a_{p}\}$
  500. is the list of upper parameters, and
  501. {\tt lower}$=\{b_{1}, b_{2}, \ldots, b_{q}\}$
  502. is the list of lower parameters depending on $n$. If Zeilberger's algorithm
  503. does not apply, {\tt extended\verb+_+sumrecursion}
  504. of \S~\ref{sec:EXTENDED_SUMRECURSION} is used.
  505. \item
  506. {\tt hyperrecursion(upper,lower,x,n,j)} $(j\in\N)$
  507. searches only for a holonomic recurrence equation of order $j$. This
  508. operator does not use {\tt extended\verb+_+sumrecursion} automatically.
  509. \end{itemize}
  510. Therefore
  511. {\small
  512. \begin{verbatim}
  513. 30: hyperrecursion({-n,b},{c},1,n);
  514. (b - c - n + 1)*sum(n - 1) + (c + n - 1)*sum(n)
  515. \end{verbatim}
  516. }\noindent
  517. establishes the Vandermonde identity
  518. \[
  519. _2 F_1\left.
  520. \!\!
  521. \left(
  522. \!\!\!\!
  523. \begin{array}{c}
  524. \multicolumn{1}{c}{\begin{array}{cc} -n\;, & b \end{array}}\\[1mm]
  525. \multicolumn{1}{c}{ c}
  526. \end{array}
  527. \!\!\!\!
  528. \right| 1\right)
  529. =\frac{(c-b)_n}{(c)_n}
  530. \;,
  531. \]
  532. whereas
  533. {\small
  534. \begin{verbatim}
  535. 31: hyperrecursion({d,1+d/2,d+b-a,d+c-a,1+a-b-c,n+a,-n},
  536. {d/2,1+a-b,1+a-c,b+c+d-a,1+d-a-n,1+d+n},1,n);
  537. (2*a - b - c - d + n)*(b + n - 1)*(c + n - 1)*(d + n)*sum(n - 1) +
  538. (a - b - c - d - n + 1)*(a - b + n)*(a - c + n)*(a - d + n - 1)
  539. *sum(n)
  540. \end{verbatim}
  541. }\noindent
  542. proves Dougall's identity, again.
  543. If a hypergeometric expression is given in hypergeometric notation, then
  544. the use of {\tt hyperrecursion} is more natural than the use of
  545. {\tt sumrecursion}.
  546. Moreover you may use the \REDUCE{} operator
  547. \begin{itemize}
  548. \item
  549. {\tt hyperterm(upper,lower,x,k)} that yields the hypergeometric term
  550. \[
  551. \frac
  552. {(a_{1})_{k}\cdot(a_{2})_{k}\cdots(a_{p})_{k}}
  553. {(b_{1})_{k}\cdot(b_{2})_{k}\cdots(b_{q})_{k}\,k!}x^{k}
  554. \]
  555. with upper parameters {\tt upper}$=\{a_{1}, a_{2}, \ldots, a_{p}\}$,
  556. and lower parameters {\tt lower}$=\{b_{1}, b_{2}, \ldots, b_{q}\}$
  557. \end{itemize}
  558. in connection with hypergeometric terms.
  559. The operator {\tt sumrecursion} can also be used to
  560. obtain three-term recurrence equations for systems of orthogonal polynomials
  561. with the aid of known hypergeometric representations. By
  562. (\cite{NSU}, (2.7.11a)), the discrete Krawtchouk polynomials $k_n^{(p)}(x,N)$
  563. have the hypergeometric representation
  564. \[
  565. k_n^{(p)}(x,N)=
  566. (-1)^n\,p^n\,{{N}\choose{n}}\;
  567. _2 F_1\left.
  568. \!\!
  569. \left(
  570. \!\!\!\!
  571. \begin{array}{c}
  572. \multicolumn{1}{c}{\begin{array}{cc} -n\;, & -x \end{array}}\\[1mm]
  573. \multicolumn{1}{c}{ -N}
  574. \end{array}
  575. \!\!\!\!
  576. \right| \frac{1}{p}\right)
  577. \;,
  578. \]
  579. and therefore we declare
  580. {\small
  581. \begin{verbatim}
  582. 32: krawtchoukterm:=
  583. (-1)^n*p^n*binomial(NN,n)*hyperterm({-n,-x},{-NN},1/p,k)$
  584. \end{verbatim}
  585. }\noindent
  586. and get the three three-term recurrence equations
  587. {\small
  588. \begin{verbatim}
  589. 33: sumrecursion(krawtchoukterm,k,n);
  590. ((2*p - 1)*n - nn*p - 2*p + x + 1)*sum(n - 1)
  591. - (n - nn - 2)*(p - 1)*sum(n - 2)*p - sum(n)*n
  592. 34: sumrecursion(krawtchoukterm,k,x);
  593. (2*(x - 1)*p + n - nn*p - x + 1)*sum(x - 1)
  594. - ((x - 1) - nn)*sum(x)*p - (p - 1)*(x - 1)*sum(x - 2)
  595. 35: sumrecursion(krawtchoukterm,k,NN);
  596. ((p - 2)*nn + n + x + 1)*sum(nn - 1) + (n - nn)*(p - 1)*sum(nn)
  597. + (nn - x - 1)*sum(nn - 2)
  598. \end{verbatim}
  599. }\noindent
  600. with respect to the parameters $n$, $x$, and $N$ respectively.
  601. \section{\REDUCE{} operator {\tt HYPERSUM}}
  602. With the operator {\tt hypersum}, hypergeometric sums are directly
  603. evaluated in closed form whenever the extended
  604. Zeilberger algorithm leads to a recurrence equation containing only
  605. two terms:
  606. \begin{itemize}
  607. \item
  608. {\tt hypersum(upper,lower,x,n)} determines a closed form representation
  609. for
  610. $_{p}F_{q}\left.\left(\begin{array}{cccc}
  611. a_{1},&a_{2},&\cdots,&a_{p}\\
  612. b_{1},&b_{2},&\cdots,&b_{q}\\
  613. \end{array}\right| x\right)
  614. $, where {\tt upper}$=\{a_{1}, a_{2}, \ldots, a_{p}\}$
  615. is the list of upper parameters, and
  616. {\tt lower}$=\{b_{1}, b_{2}, \ldots, b_{q}\}$
  617. is the list of lower parameters depending on $n$. The result is given as a
  618. hypergeometric term with respect to $n$.
  619. If the result is a list of length $m$, we call it $m$-{\sl fold symmetric},
  620. which is to be interpreted as follows:
  621. Its $j^{th}$ part is the solution valid for all $n$ of the form $n=mk+j-1
  622. \;(k\in\N_0)$.
  623. In particular, if the resulting list contains two terms, then
  624. the first part is the solution for even $n$, and the second part is the
  625. solution for odd $n$.
  626. \end{itemize}
  627. Examples \cite{Koepf}:
  628. {\small
  629. \begin{verbatim}
  630. 36: hypersum({a,1+a/2,c,d,-n},{a/2,1+a-c,1+a-d,1+a+n},1,n);
  631. pochhammer(a - c - d + 1,n)*pochhammer(a + 1,n)
  632. -------------------------------------------------
  633. pochhammer(a - c + 1,n)*pochhammer(a - d + 1,n)
  634. 37: hypersum({a,1+a/2,d,-n},{a/2,1+a-d,1+a+n},-1,n);
  635. pochhammer(a + 1,n)
  636. -------------------------
  637. pochhammer(a - d + 1,n)
  638. \end{verbatim}
  639. }\noindent
  640. Note that the operator {\tt togamma} converts expressions given in
  641. factorial-$\Gamma$-binomial-Pochhammer notation
  642. into a pure $\Gamma$ function representation:
  643. {\small
  644. \begin{verbatim}
  645. 38: togamma(ws);
  646. gamma(a - d + 1)*gamma(a + n + 1)
  647. -----------------------------------
  648. gamma(a - d + n + 1)*gamma(a + 1)
  649. \end{verbatim}
  650. }\noindent
  651. Here are some $m$-fold symmetric results:
  652. {\small
  653. \begin{verbatim}
  654. 39: hypersum({-n,-n,-n},{1,1},1,n);
  655. n/2 2 n 1 n
  656. ( - 27) *pochhammer(---,---)*pochhammer(---,---)
  657. 3 2 3 2
  658. {----------------------------------------------------,
  659. n 2
  660. factorial(---)
  661. 2
  662. 0}
  663. 40: hypersum({-n,n+3*a,a},{3*a/2,(3*a+1)/2},3/4,n);
  664. 2 n 1 n
  665. pochhammer(---,---)*pochhammer(---,---)
  666. 3 3 3 3
  667. {-----------------------------------------------------,
  668. 3*a + 2 n 3*a + 1 n
  669. pochhammer(---------,---)*pochhammer(---------,---)
  670. 3 3 3 3
  671. 0,
  672. 0}
  673. \end{verbatim}
  674. }\noindent
  675. These results correspond to the formulas (compare \cite{Koepf})
  676. \[
  677. _3 F_2\left.
  678. \!\!
  679. \left(
  680. \!\!\!\!
  681. \begin{array}{c}
  682. \multicolumn{1}{c}{\begin{array}{c}
  683. -n\;, -n\;, -n
  684. \end{array}}\\[1mm]
  685. \multicolumn{1}{c}{\begin{array}{c}
  686. 1 \;, 1
  687. \end{array}}\end{array}
  688. \!\!\!\!
  689. \right| 1\right)
  690. =
  691. \funkdef{0}{n\;\mbox{odd}}{\displaystyle
  692. \frac{(1/3)_{n/2}\,(2/3)_{n/2}}{(n/2)!^2}\,(-27)^{n/2}
  693. }
  694. \]
  695. and
  696. \[
  697. _3 F_2\left.
  698. \!\!
  699. \left(
  700. \!\!\!\!
  701. \begin{array}{c}
  702. \multicolumn{1}{c}{\begin{array}{c}
  703. -n\;, n+3a\;, a
  704. \end{array}}\\[1mm]
  705. \multicolumn{1}{c}{\begin{array}{c}
  706. 3a/2\;,(3a+1)/2
  707. \end{array}}\end{array}
  708. \!\!\!\!
  709. \right| \frac{3}{4}\right)
  710. =
  711. \funkdef{0}{n\neq 0 {\mbox{ (mod }} 3)}{\displaystyle
  712. \frac{(1/3)_{n/3}\,(2/3)_{n/3}}
  713. {(a+1/3)_{n/3}\,(a+2/3)_{n/3}}
  714. }
  715. \!\!\!\!\!\!\!\!.
  716. \]
  717. \section{\REDUCE{} operator {\tt SUMTOHYPER}}
  718. With the operator {\tt sumtohyper}, sums given in
  719. factorial-$\Gamma$-binomial-Poch\-hammer notation
  720. are converted into hypergeometric notation.
  721. \begin{itemize}
  722. \item
  723. {\tt sumtohyper(f,k)} determines the hypergeometric representation
  724. of\linebreak
  725. $\sum\limits_{k=-\infty}^\infty f_k$, i.\ e.\
  726. its output is {\tt c*hypergeometric(upper,lower,x)}, corresponding to
  727. the representation
  728. \[
  729. \sum\limits_{k=-\infty}^\infty f_k=c\cdot\;
  730. _{p}F_{q}\left.\left(\begin{array}{cccc}
  731. a_{1},&a_{2},&\cdots,&a_{p}\\
  732. b_{1},&b_{2},&\cdots,&b_{q}\\
  733. \end{array}\right| x\right)
  734. \;,
  735. \]
  736. where {\tt upper}$=\{a_{1}, a_{2}, \ldots, a_{p}\}$
  737. and {\tt lower}$=\{b_{1}, b_{2}, \ldots, b_{q}\}$
  738. are the lists of upper and lower parameters.
  739. \end{itemize}
  740. Examples:
  741. {\small
  742. \begin{verbatim}
  743. 41: sumtohyper(binomial(n,k)^3,k);
  744. hypergeometric({ - n, - n, - n},{1,1},-1)
  745. 42: sumtohyper(binomial(n,k)/2^n-sub(n=n-1,binomial(n,k)/2^n),k);
  746. - n + 2 - n
  747. - hypergeometric({----------, - n,1},{1,------},-1)
  748. 2 2
  749. ------------------------------------------------------
  750. n
  751. 2
  752. \end{verbatim}
  753. }\noindent
  754. \section{Simplification Operators}
  755. For the decision that an expression $a_k$ is a hypergeometric term, it is
  756. necessary to find out whether or not $a_{k}/a_{k-1}$ is a rational
  757. function with respect to $k$. For the purpose to decide
  758. whether or not an expression involving powers, factorials,
  759. $\Gamma$ function terms,
  760. binomial coefficients, and Pochhammer symbols is a hypergeometric term,
  761. the following simplification operators can be used:
  762. \begin{itemize}
  763. \item
  764. {\tt simplify\verb+_+gamma(f)} simplifies an expression {\tt f} involving
  765. only rational, powers and $\Gamma$ function terms according to a recursive
  766. application of the simplification rule $\Gamma\:(a+1)=a\,\Gamma\:(a)$
  767. to the expression tree. Since all $\Gamma$ arguments with integer difference
  768. are transformed, this gives a decision procedure for rationality
  769. for integer-linear $\Gamma$ term product ratios.
  770. \item
  771. {\tt simplify\verb+_+combinatorial(f)} simplifies an expression {\tt f}
  772. involving powers, factorials, $\Gamma$ function terms,
  773. binomial coefficients, and Pochhammer symbols by converting
  774. factorials, binomial coefficients, and Poch\-hammer symbols into
  775. $\Gamma$ function terms, and applying {\tt simplify\verb+_+gamma} to its
  776. result. If the output is not rational,
  777. it is given in terms of $\Gamma$ functions. If you prefer factorials
  778. you may use
  779. \item
  780. {\tt gammatofactorial} (rule) converting $\Gamma$ function terms into
  781. factorials using $\Gamma\:(x)\rightarrow (x-1)!$.
  782. \item
  783. {\tt simplify\verb+_+gamma2(f)}
  784. uses the duplication formula of the $\Gamma$ function to simplify $f$.
  785. \item
  786. {\tt simplify\verb+_+gamman(f,n)}
  787. uses the multiplication formula of the $\Gamma$ function to simplify $f$.
  788. \end{itemize}
  789. The use of {\tt simplify\verb+_+combinatorial(f)} is a safe way to
  790. decide the rationality for any ratio of products of powers, factorials,
  791. $\Gamma$ function terms, binomial coefficients, and Pochhammer symbols.
  792. Example:
  793. {\small
  794. \begin{verbatim}
  795. 43: simplify_combinatorial(sub(k=k+1,krawtchoukterm)/krawtchoukterm);
  796. (k - n)*(k - x)
  797. --------------------
  798. (k - nn)*(k + 1)*p
  799. \end{verbatim}
  800. }\noindent
  801. From this calculation, we see again that the upper parameters of
  802. the hypergeometric representation of the Krawtchouk polynomials are given by
  803. $\{-n,-x\}$, its lower parameter is $\{-N\}$, and the argument of the
  804. hypergeometric function is $1/p$.
  805. Other examples are
  806. {\small
  807. \begin{verbatim}
  808. 44: simplify_combinatorial(binomial(n,k)/binomial(2*n,k-1));
  809. gamma( - (k - 2*n - 2))*gamma(n + 1)
  810. ----------------------------------------
  811. gamma( - (k - n - 1))*gamma(2*n + 1)*k
  812. 45: ws where gammatofactorial;
  813. factorial( - k + 2*n + 1)*factorial(n)
  814. ----------------------------------------
  815. factorial( - k + n)*factorial(2*n)*k
  816. 46: simplify_gamma2(gamma(2*n)/gamma(n));
  817. 2*n 2*n + 1
  818. 2 *gamma(---------)
  819. 2
  820. -----------------------
  821. 2*sqrt(pi)
  822. 47: simplify_gamman(gamma(3*n)/gamma(n),3);
  823. 3*n 3*n + 2 3*n + 1
  824. 3 *gamma(---------)*gamma(---------)
  825. 3 3
  826. ----------------------------------------
  827. 2*sqrt(3)*pi
  828. \end{verbatim}
  829. }\noindent
  830. \section{Tracing}
  831. If you set
  832. {\small
  833. \begin{verbatim}
  834. 48: on zb_trace;
  835. \end{verbatim}
  836. }\noindent
  837. tracing is enabled, and you get intermediate results, see \cite{Koepf}.
  838. Example for the Gosper algorithm:
  839. {\small
  840. \begin{verbatim}
  841. 49: gosper(pochhammer(k-n,n),k);
  842. k - 1
  843. a(k)/a(k-1):= -----------
  844. k - n - 1
  845. Gosper algorithm applicable
  846. p:= 1
  847. q:= k - 1
  848. r:= k - n - 1
  849. degreebound := 0
  850. 1
  851. f:= -------
  852. n + 1
  853. Gosper algorithm successful
  854. pochhammer(k - n,n)*k
  855. -----------------------
  856. n + 1
  857. \end{verbatim}
  858. }\noindent
  859. \vspace*{3mm}\noindent
  860. Example for the Zeilberger algorithm:
  861. \vspace*{3mm}
  862. {\footnotesize
  863. \begin{verbatim}
  864. 50: sumrecursion(binomial(n,k)^2,k,n);
  865. 2
  866. n
  867. F(n,k)/F(n-1,k):= ----------
  868. 2
  869. (k - n)
  870. 2
  871. (k - n - 1)
  872. F(n,k)/F(n,k-1):= --------------
  873. 2
  874. k
  875. Zeilberger algorithm applicable
  876. applying Zeilberger algorithm for order:= 1
  877. 2 2 2
  878. p:= zb_sigma(1)*k - 2*zb_sigma(1)*k*n + zb_sigma(1)*n + n
  879. 2 2
  880. q:= k - 2*k*n - 2*k + n + 2*n + 1
  881. 2
  882. r:= k
  883. degreebound := 1
  884. 2*k - 3*n + 2
  885. f:= ---------------
  886. n
  887. 2 2 2 3 2
  888. - 4*k *n + 2*k + 8*k*n - 4*k*n - 3*n + 2*n
  889. p:= -------------------------------------------------
  890. n
  891. Zeilberger algorithm successful
  892. 4*sum(n - 1)*n - 2*sum(n - 1) - sum(n)*n
  893. 51: off zb_trace;
  894. \end{verbatim}
  895. }\noindent
  896. \section{Global Variables and Switches}
  897. The following global variables and switches can be used in connection with
  898. the {\tt ZEILBERG} package:
  899. \begin{itemize}
  900. \item
  901. {\tt zb\verb+_+trace}, switch; default setting {\tt off}.
  902. Turns tracing on and off.
  903. \item
  904. {\tt zb\verb+_+direction}, variable; settings: {\tt down}, {\tt up};
  905. default setting {\tt down}.
  906. In the case of the Gosper algorithm, either a downward or a forward
  907. antidifference is calculated, i.\ e., {\tt gosper} finds $g_k$ with either
  908. \[
  909. a_k=g_k-g_{k-1}
  910. \quad\quad\mbox{or}\quad\quad
  911. a_k=g_{k+1}-g_{k},
  912. \]
  913. respectively.
  914. In the case of the Zeilberger algorithm, either a downward or an upward
  915. recurrence equation is returned. Example:
  916. {\small
  917. \begin{verbatim}
  918. 52: zb_direction:=up$
  919. 53: sumrecursion(binomial(n,k)^2,k,n);
  920. sum(n + 1)*n + sum(n + 1) - 4*sum(n)*n - 2*sum(n)
  921. 54: zb_direction:=down$
  922. \end{verbatim}
  923. }\noindent
  924. \item
  925. {\tt zb\verb+_+order}, variable; settings: any nonnegative integer;
  926. default setting~{\tt 5}.
  927. Gives the maximal order for the recurrence
  928. equation that {\tt sumrecursion} searches for.
  929. \item
  930. {\tt zb\verb+_+factor}, switch; default setting {\tt on}.
  931. If {\tt off}, the factorization of the output usually producing nicer results
  932. is suppressed.
  933. \item
  934. {\tt zb\verb+_+proof}, switch; default setting {\tt off}. If {\tt on},
  935. then several intermediate results are stored in global variables:
  936. \item
  937. {\tt gosper\verb+_+representation}, variable; default setting {\tt nil}.
  938. If a {\tt gosper} command is issued, and if the Gosper algorithm is applicable,
  939. then the variable {\tt gosper\verb+_+representation} is set to the
  940. list of polynomials (with respect to $k$) {\tt \{p,q,r,f\}}
  941. corresponding to the representation
  942. \[
  943. \frac{a_k}{a_{k-1}}=\frac{p_k}{p_{k-1}}\,\frac{q_k}{r_k}
  944. \;,
  945. \quad\quad\quad
  946. g_k=\frac{q_{k+1}}{p_k}\,f_k\,a_k
  947. \;,
  948. \]
  949. see \cite{Gos}. Examples:
  950. {\small
  951. \begin{verbatim}
  952. 55: on zb_proof;
  953. 56: gosper(k*factorial(k),k);
  954. (k + 1)*factorial(k)
  955. 57: gosper_representation;
  956. {k,k,1,1}
  957. 58: gosper(
  958. 1/(k+1)*binomial(2*k,k)/(n-k+1)*binomial(2*n-2*k,n-k),k);
  959. ((2*k - n + 1)*(2*k + 1)*binomial( - 2*(k - n), - (k - n))
  960. *binomial(2*k,k))/((k + 1)*(n + 2)*(n + 1))
  961. 59: gosper_representation;
  962. {1,
  963. (2*k - 1)*(k - n - 2),
  964. (2*k - 2*n - 1)*(k + 1),
  965. - (2*k - n + 1)
  966. ------------------}
  967. (n + 2)*(n + 1)
  968. \end{verbatim}
  969. }\noindent
  970. \item
  971. {\tt zeilberger\verb+_+representation}, variable; default setting {\tt nil}.
  972. If a {\tt sumrecursion} command is issued, and if the Zeilberger
  973. algorithm is successful, then the variable
  974. {\tt zeilberger\verb+_+representation} is set to the final Gosper
  975. representation used, see \cite{Koornwinder}.
  976. \end{itemize}
  977. \section{Messages}
  978. The following messages may occur:
  979. \begin{itemize}
  980. \item
  981. {\tt ***** Gosper algorithm:\ no closed form solution exists}
  982. Example input:
  983. {\tt gosper(factorial(k),k)}.
  984. \item
  985. {\tt ***** Gosper algorithm not applicable}
  986. Example input:
  987. {\tt gosper(factorial(k/2),k)}.
  988. The term ratio $a_k/a_{k-1}$ is not rational.
  989. \item
  990. {\tt ***** illegal number of arguments}
  991. Example input:
  992. {\tt gosper(k)}.
  993. \item
  994. {\tt ***** Zeilberger algorithm fails.\ Enlarge zb\verb+_+order}
  995. Example input:
  996. {\tt sumrecursion(binomial(n,k)*binomial(6*k,n),k,n)}
  997. For this example a setting {\tt zb\verb+_+order:=6} is needed.
  998. \item
  999. {\tt ***** Zeilberger algorithm not applicable}
  1000. Example input:
  1001. {\tt sumrecursion(binomial(n/2,k),k,n)}
  1002. One of the term ratios $f(n,k)/f(n-1,k)$ or $f(n,k)/f(n,k-1)$
  1003. is not rational.
  1004. \item
  1005. {\tt ***** SOLVE given inconsistent equations}
  1006. You can ignore this message that occurs with Version 3.5.
  1007. \end{itemize}
  1008. \begin{thebibliography}{99}
  1009. \bibitem{Gos}
  1010. Gosper Jr., R.\ W.:
  1011. Decision procedure for indefinite hypergeometric
  1012. summation. Proc.\ Natl.\ Acad.\ Sci.\ USA {\bf 75}, 1978, 40--42.
  1013. \bibitem{Koepf}
  1014. Koepf, W.:
  1015. Algorithms for the indefinite and definite summation.
  1016. Konrad-Zuse-Zentrum Berlin (ZIB), Preprint SC 94-33, 1994.
  1017. \bibitem{Koornwinder}
  1018. Koornwinder, T.\ H.:
  1019. On Zeilberger's algorithm and its $q$-analogue: a rigorous description.
  1020. J.\ of Comput.\ and Appl.\ Math.\ {\bf 48}, 1993, 91--111.
  1021. \bibitem{NSU}
  1022. Nikiforov, A.\ F., Suslov, S.\ K,\ and Uvarov, V.\ B.: {\sl Classical
  1023. orthogonal polynomials of a discrete variable.} Springer-Verlag,
  1024. Berlin--Heidelberg--New York, 1991.
  1025. \bibitem{PS}
  1026. Paule, P.\ and Schorn, M.: A {\sc Mathematica} version of Zeilberger's
  1027. algorithm for proving binomial coefficient identities. J.\ Symbolic
  1028. Computation, 1994, to appear.
  1029. \bibitem{SR}
  1030. Problem 94--2, SIAM Review {\bf 36}, March 1994.
  1031. \bibitem{Strehl2}
  1032. Strehl, V.:
  1033. Binomial sums and identities. Maple Technical Newsletter {\bf 10}, 1993, 37--49.
  1034. \bibitem{Wil1}
  1035. Wilf, H.\ S.:
  1036. {\sl Generatingfunctionology}. Academic Press, Boston, 1990.
  1037. \bibitem{Wilf}
  1038. Wilf, H.\ S.:
  1039. Identities and their computer proofs. ``SPICE'' Lecture Notes,
  1040. August 31--September 2, 1993.
  1041. Anonymous ftp file {\tt pub/wilf/lecnotes.ps} on
  1042. the server {\tt ftp.cis.upenn.edu}.
  1043. \bibitem{Zei2}
  1044. Zeilberger, D.:
  1045. A fast algorithm for proving terminating hypergeometric identities.
  1046. Discrete Math.\ {\bf 80}, 1990, 207--211.
  1047. \bibitem{Zei3}
  1048. Zeilberger, D.:
  1049. The method of creative telescoping.
  1050. J.\ Symbolic Computation {\bf 11}, 1991, 195--204.
  1051. \end{thebibliography}
  1052. \end{document}