 sumtools - Maple Programming Help

sumtools

 gosper
 Gosper's algorithm for summation

 Calling Sequence gosper(f, k) gosper(f, k=m..n)

Parameters

 f - expression k - name, summation variable m, n - expressions, representing upper and lower summation bounds

Description

 • This function is an implementation of Gosper's algorithm, and calculates a closed form (upward) antidifference of a closed form expression f whenever a closed form (upward) antidifference exists. In this case, the procedure can be used to calculate definite sums

$\sum _{k=m}^{n}f\left(k\right)$

 whenever f does not depend on variables occurring in m and n.
 • An expression f is called closed form with respect to k if

$\frac{\mathrm{subs}\left(k=k+1,f\right)}{f}$

 is rational with respect to k. This is typically the case for ratios of products of rational functions, exponentials, factorials, binomial coefficients, and Pochhammer symbols that are integer-linear in their arguments. The implementation supports this type of input.
 • An expression g is called closed form upward antidifference of f if

$f=\mathrm{subs}\left(k=k+1,g\right)-g$

 • If the second argument k is a name, then gosper returns the closed form (upward) antidifference of f with respect to k, or FAIL, if either the input function is no closed form expression, or no closed form antidifference exists.  Which of these cases applies, can be seen with ${\mathrm{infolevel}}_{\mathrm{sum}}≔2$ .
 • If the second argument has the form $k=m..n$ then the definite sum

$\sum _{k=m}^{n}f\left(k\right)$

 is determined if Gosper's algorithm applies.
 • The command with(sumtools,gosper) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{sumtools}\right):$

see (SIAM Review, 1994, Problem 94-2)

 > $\mathrm{gosper}\left(\frac{{\left(-1\right)}^{k+1}\left(4k+1\right)\left(2k\right)!}{k!{4}^{k}\left(2k-1\right)\left(k+1\right)!},k\right)$
 ${-}\frac{{2}{}\left({k}{+}{1}\right){}{\left({-1}\right)}^{{k}{+}{1}}{}\left({2}{}{k}\right){!}}{{k}{!}{}{{4}}^{{k}}{}\left({2}{}{k}{-}{1}\right){}\left({k}{+}{1}\right){!}}$ (1)
 > $\mathrm{gosper}\left(\mathrm{binomial}\left(k,n\right),k\right)$
 $\frac{\left({k}{-}{n}\right){}\left(\genfrac{}{}{0}{}{{k}}{{n}}\right)}{{n}{+}{1}}$ (2)
 > $\mathrm{gosper}\left(\frac{\mathrm{binomial}\left(n,k\right)}{{2}^{n}}-\frac{\mathrm{binomial}\left(n-1,k\right)}{{2}^{n-1}},k\right)$
 ${-}\frac{{k}{}\left(\frac{\left(\genfrac{}{}{0}{}{{n}}{{k}}\right)}{{{2}}^{{n}}}{-}\frac{\left(\genfrac{}{}{0}{}{{n}{-}{1}}{{k}}\right)}{{{2}}^{{n}{-}{1}}}\right)}{{2}{}{k}{-}{n}}$ (3)
 > $\mathrm{gosper}\left(\mathrm{pochhammer}\left(k,n\right),k\right)$
 $\frac{\left({k}{-}{1}\right){}{\mathrm{pochhammer}}{}\left({k}{,}{n}\right)}{{n}{+}{1}}$ (4)
 > $\mathrm{gosper}\left(\frac{\mathrm{pochhammer}\left(b,k\right)}{k!},k=0..n\right)$
 $\frac{\left({n}{+}{1}\right){}{\mathrm{pochhammer}}{}\left({b}{,}{n}{+}{1}\right)}{{b}{}\left({n}{+}{1}\right){!}}$ (5)
 > $\mathrm{gosper}\left(\left(\frac{k}{2}\right)!,k\right)$
 ${\mathrm{FAIL}}$ (6)
 > $\mathrm{gosper}\left(\frac{1}{k},k\right)$
 ${\mathrm{FAIL}}$ (7)