2 * Introduction to zeilberger::
3 * Functions and Variables for zeilberger::
6 @node Introduction to zeilberger, Functions and Variables for zeilberger, Package zeilberger, Package zeilberger
7 @section Introduction to zeilberger
9 @code{zeilberger} is an implementation of Zeilberger's algorithm
10 for definite hypergeometric summation, and also
11 Gosper's algorithm for indefinite hypergeometric
14 @code{zeilberger} makes use of the "filtering" optimization method developed by Axel Riese.
16 @code{zeilberger} was developed by Fabrizio Caruso.
18 @code{load ("zeilberger")} loads this package.
20 @opencatbox{Categories:}
21 @category{Sums and products}
22 @category{Share packages}
23 @category{Package zeilberger}
26 @subsection The indefinite summation problem
28 @code{zeilberger} implements Gosper's algorithm for indefinite hypergeometric summation.
29 Given a hypergeometric term @math{F_k} in @math{k} we want to find its hypergeometric
30 anti-difference, that is, a hypergeometric term @math{f_k} such that
33 <<<F_k = f_{k+1} - f_k.>>>,
34 <<<@math{F_k = f_(k+1) - f_k}.>>>)
36 @subsection The definite summation problem
38 @code{zeilberger} implements Zeilberger's algorithm for definite hypergeometric summation.
39 Given a proper hypergeometric term (in @math{n} and @math{k})
40 m4_math(<<<F_{n,k}>>>,<<<@math{F_(n,k)}>>>)
42 a positive integer @math{d} we want to find a @math{d}-th order linear
43 recurrence with polynomial coefficients (in @math{n}) for
44 m4_math(<<<F_{n,k}>>>,<<<@math{F_(n,k)}>>>)
46 a rational function @math{R} in @math{n} and @math{k} such that
49 <<<a_0 \, F_{n,k} + \ldots + a_d \, F_{n+d,k} = \Delta_K \left(R\left(n,k\right) F_{n,k}\right),>>>,
50 <<<@math{a_0 F_(n,k) + ... + a_d F_(n+d,k) = Delta_k(R(n,k) F_(n,k))},>>>)
52 m4_math(\Delta_k, @math{Delta_k})
53 is the @math{k}-forward difference
56 <<<\Delta_k \left(t_k\right) \equiv t_{k+1} - t_k>>>,
57 <<<@math{Delta_k(t_k) := t_(k+1) - t_k}>>>)
59 @subsection Verbosity levels
61 There are also verbose versions of the commands
62 which are called by adding one of the following prefixes:
66 Just a summary at the end is shown
68 Some information in the intermediate steps
72 Even more information including information on
73 the linear system in Zeilberger's algorithm
77 @code{GosperVerbose}, @code{parGosperVeryVerbose},
78 @code{ZeilbergerExtra}, @code{AntiDifferenceSummary}.
81 @node Functions and Variables for zeilberger, , Introduction to zeilberger, Package zeilberger
82 @section Functions and Variables for zeilberger
84 @anchor{AntiDifference}
85 @deffn {Function} AntiDifference (@math{F_k}, @var{k})
87 Returns the hypergeometric anti-difference of @math{F_k}, if it exists.@*
88 Otherwise @code{AntiDifference} returns @code{no_hyp_antidifference}.
90 @opencatbox{Categories:}
91 @category{Package zeilberger}
97 @deffn {Function} Gosper (@math{F_k}, @var{k})
98 Returns the rational certificate @math{R(k)} for @math{F_k}, that is,
99 a rational function such
101 m4_mathcomma(<<<F_k = R\left(k+1\right) \, F_{k+1} - R\left(k\right) \, F_k>>>,<<<@math{F_k = R(k+1) F_(k+1) - R(k) F_k}>>>)
103 Otherwise, @code{Gosper} returns @code{no_hyp_sol}.
105 @opencatbox{Categories:}
106 @category{Package zeilberger}
112 @deffn {Function} GosperSum (@math{F_k}, @var{k}, @var{a}, @var{b})
114 Returns the summation of @math{F_k} from @math{@var{k} = @var{a}} to @math{@var{k} = @var{b}}
115 if @math{F_k} has a hypergeometric anti-difference.
116 Otherwise, @code{GosperSum} returns @code{nongosper_summable}.
121 @c load ("zeilberger")$
122 @c GosperSum ((-1)^k*k / (4*k^2 - 1), k, 1, n);
123 @c GosperSum (1 / (4*k^2 - 1), k, 1, n);
124 @c GosperSum (x^k, k, 1, n);
125 @c GosperSum ((-1)^k*a! / (k!*(a - k)!), k, 1, n);
126 @c GosperSum (k*k!, k, 1, n);
127 @c GosperSum ((k + 1)*k! / (k + 1)!, k, 1, n);
128 @c GosperSum (1 / ((a - k)!*k!), k, 1, n);
131 (%i1) load ("zeilberger")$
133 (%i2) GosperSum ((-1)^k*k / (4*k^2 - 1), k, 1, n);
134 Dependent equations eliminated: (1)
138 (%o2) - ------------------ - -
143 (%i3) GosperSum (1 / (4*k^2 - 1), k, 1, n);
147 (%o3) -------------- + -
152 (%i4) GosperSum (x^k, k, 1, n);
159 (%i5) GosperSum ((-1)^k*a! / (k!*(a - k)!), k, 1, n);
162 (%o5) - ------------------------- - ----------
163 a (- n + a - 1)! (n + 1)! a (a - 1)!
166 (%i6) GosperSum (k*k!, k, 1, n);
167 Dependent equations eliminated: (1)
171 (%i7) GosperSum ((k + 1)*k! / (k + 1)!, k, 1, n);
172 (n + 1) (n + 2) (n + 1)!
173 (%o7) ------------------------ - 1
177 (%i8) GosperSum (1 / ((a - k)!*k!), k, 1, n);
178 (%o8) NON_GOSPER_SUMMABLE
182 @opencatbox{Categories:}
183 @category{Package zeilberger}
190 @deffn {Function} parGosper (@math{F_{n,k}}, @var{k}, @var{n}, @var{d})
192 Attempts to find a @var{d}-th order recurrence for
197 The algorithm yields a sequence @math{[s_1, s_2, ..., s_m]} of solutions.
198 Each solution has the form
201 $$\left[R\left(n, k\right), \left[a_0, a_1, \ldots, a_d\right]\right].$$
204 @code{parGosper} returns @code{[]} if it fails to find a recurrence.
206 @opencatbox{Categories:}
207 @category{Package zeilberger}
215 @deffn {Function} parGosper (@math{F_(n,k)}, @var{k}, @var{n}, @var{d})
217 Attempts to find a @var{d}-th order recurrence for @math{F_(n,k)}.
219 The algorithm yields a sequence @math{[s_1, s_2, ..., s_m]} of solutions.
220 Each solution has the form
222 @math{[R(n, k), [a_0, a_1, ..., a_d]].}
224 @code{parGosper} returns @code{[]} if it fails to find a recurrence.
226 @opencatbox{Categories:}
227 @category{Package zeilberger}
235 @deffn {Function} Zeilberger (@math{F_{n,k}}, @var{k}, @var{n})
237 Attempts to compute the indefinite hypergeometric summation of
242 @code{Zeilberger} first invokes @code{Gosper}, and if that fails to find a solution, then invokes
243 @code{parGosper} with order 1, 2, 3, ..., up to @code{MAX_ORD}.
244 If Zeilberger finds a solution before reaching @code{MAX_ORD},
245 it stops and returns the solution.
247 The algorithms yields a sequence @math{[s_1, s_2, ..., s_m]} of solutions.
248 Each solution has the form
251 $$\left[R\left(n, k\right), \left[a_0, a_1, \ldots, a_d\right]\right].$$
254 @code{Zeilberger} returns @code{[]} if it fails to find a solution.
256 @code{Zeilberger} invokes @code{Gosper} only if @code{Gosper_in_Zeilberger} is @code{true}.
258 @opencatbox{Categories:}
259 @category{Package zeilberger}
267 @deffn {Function} Zeilberger (@math{F_(n,k)}, @var{k}, @var{n})
269 Attempts to compute the indefinite hypergeometric summation of @math{F_(n,k)}.
271 @code{Zeilberger} first invokes @code{Gosper}, and if that fails to find a solution, then invokes
272 @code{parGosper} with order 1, 2, 3, ..., up to @code{MAX_ORD}.
273 If Zeilberger finds a solution before reaching @code{MAX_ORD},
274 it stops and returns the solution.
276 The algorithms yields a sequence @math{[s_1, s_2, ..., s_m]} of solutions.
277 Each solution has the form
279 @math{[R(n,k), [a_0, a_1, ..., a_d]].}
281 @code{Zeilberger} returns @code{[]} if it fails to find a solution.
283 @code{Zeilberger} invokes @code{Gosper} only if @code{Gosper_in_Zeilberger} is @code{true}.
285 @opencatbox{Categories:}
286 @category{Package zeilberger}
293 @node General global variables, Variables related to the modular test, Functions and Variables for zeilberger
294 @section General global variables
297 @defvr {Global variable} MAX_ORD
300 @code{MAX_ORD} is the maximum recurrence order attempted by @code{Zeilberger}.
302 @opencatbox{Categories:}
303 @category{Package zeilberger}
308 @anchor{simplified_output}
309 @defvr {Global variable} simplified_output
310 Default value: @code{false}
312 When @code{simplified_output} is @code{true},
313 functions in the @code{zeilberger} package attempt
314 further simplification of the solution.
316 @opencatbox{Categories:}
317 @category{Package zeilberger}
322 @anchor{linear_solver}
323 @defvr {Global variable} linear_solver
324 Default value: @code{linsolve}
326 @code{linear_solver} names the solver which is used to solve the system
327 of equations in Zeilberger's algorithm.
329 @opencatbox{Categories:}
330 @category{Package zeilberger}
336 @defvr {Global variable} warnings
337 Default value: @code{true}
339 When @code{warnings} is @code{true},
340 functions in the @code{zeilberger} package print
341 warning messages during execution.
343 @opencatbox{Categories:}
344 @category{Package zeilberger}
349 @anchor{Gosper_in_Zeilberger}
350 @defvr {Global variable} Gosper_in_Zeilberger
351 Default value: @code{true}
353 When @code{Gosper_in_Zeilberger} is @code{true},
354 the @code{Zeilberger} function calls @code{Gosper} before calling @code{parGosper}.
355 Otherwise, @code{Zeilberger} goes immediately to @code{parGosper}.
357 @opencatbox{Categories:}
358 @category{Package zeilberger}
363 @anchor{trivial_solutions}
364 @defvr {Global variable} trivial_solutions
365 Default value: @code{true}
367 When @code{trivial_solutions} is @code{true},
368 @code{Zeilberger} returns solutions
369 which have certificate equal to zero, or all coefficients equal to zero.
371 @opencatbox{Categories:}
372 @category{Package zeilberger}
377 @node Variables related to the modular test, , General global variables
378 @section Variables related to the modular test
381 @defvr {Global variable} mod_test
382 Default value: @code{false}
384 When @code{mod_test} is @code{true},
385 @code{parGosper} executes a
386 modular test for discarding systems with no solutions.
388 @opencatbox{Categories:}
389 @category{Package zeilberger}
394 @anchor{modular_linear_solver}
395 @defvr {Global variable} modular_linear_solver
396 Default value: @code{linsolve}
398 @code{modular_linear_solver} names the linear solver used by the modular test in @code{parGosper}.
400 @opencatbox{Categories:}
401 @category{Package zeilberger}
407 @defvr {Global variable} ev_point
408 Default value: @code{big_primes[10]}
410 @code{ev_point} is the value at which the variable @var{n} is evaluated
411 when executing the modular test in @code{parGosper}.
413 @opencatbox{Categories:}
414 @category{Package zeilberger}
419 @anchor{mod_big_prime}
420 @defvr {Global variable} mod_big_prime
421 Default value: @code{big_primes[1]}
423 @code{mod_big_prime} is the modulus used by the modular test in @code{parGosper}.
425 @opencatbox{Categories:}
426 @category{Package zeilberger}
431 @anchor{mod_threshold}
432 @defvr {Global variable} mod_threshold
435 @code{mod_threshold} is the
436 greatest order for which the modular test in @code{parGosper} is attempted.
438 @opencatbox{Categories:}
439 @category{Package zeilberger}