SumTools - Maple Programming Help

Home : Support : Online Help : Mathematics : Discrete Mathematics : Summation and Difference Equations : SumTools : SumTools/Summation

SumTools

 Summation
 compute closed forms of definite and indefinite sums
 DefiniteSummation
 compute closed forms of definite sums
 IndefiniteSummation
 compute closed forms of indefinite sums

 Calling Sequence Summation(f, k) Summation(f, k=m..n, parametric) Summation(f, k=alpha) Summation(f, expr) DefiniteSummation(f, k=m..n, parametric) DefiniteSummation(f, k=alpha) DefiniteSummation(f, k=expr) IndefiniteSummation(f, k)

Parameters

 f - expression; specified summand k - name; summation index m, n - integers or expressions parametric - (optional) literal name alpha - RootOf expression expr - expression not containing k

Options

 • If the option parametric is specified for a definite sum, then a result is returned that is valid for all possible integer values of any parameters occurring in the summand or the summation bounds. In general, the result is expressed in terms of piecewise functions.

Description

 • The IndefiniteSummation(f, k) command computes a closed form of the indefinite sum of f with respect to k, that is, it finds a function $g\left(k\right)$ such that $g\left(k+1\right)-g\left(k\right)=f\left(k\right)$.
 • The DefiniteSummation(f, k=m..n) command computes a closed form of the definite sum of $f\left(k\right)$ over the specified range $m..n$.
 For notational convenience, there are two special cases:
 - The DefiniteSummation(f, k=alpha) command, where alpha is a RootOf structure, computes the definite sum of $f\left(k\right)$ over the index of the specified RootOf
 - The DefiniteSummation(f, k=expr) command is used for function evaluation at a specified point. This is an equivalence of eval(f, k=expr).
 • The Summation(f, ...) command is the combination of DefiniteSummation and IndefiniteSummation commands.
 For a specified summation problem give to Summation, there is a preprocess that classifies whether the summation is a definite or indefinite sum.  It then calls either IndefiniteSummation or DefiniteSummation as appropriate.
 • If Summation, IndefiniteSummation, or DefiniteSummation fails to compute a closed form, the unevaluated sum returns.
 Note: The sum routine recognizes various resummation methods and thus is able to give the 'correct' value for various classes of divergent sums. If the environment variable _EnvFormal is set to true, sum uses this technique.
 If _EnvFormal is set to false, then Maple tries harder to determine whether the given definite sum is divergent and returns infinity, -infinity, or unevaluated in that case. Note that this may slow down the computation.
 In that case, Maple also tries to recognize removable singularities in the summation interval.
 By default, _EnvFormal is unassigned.

Examples

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

Two examples of indefinite sums.

Example 1.

 > $F≔\mathrm{binomial}\left(\frac{n}{2}+k,k\right){2}^{-k}$
 ${F}{≔}\left(\genfrac{}{}{0}{}{\frac{{n}}{{2}}{+}{k}}{{k}}\right){}{{2}}^{{-}{k}}$ (1)
 > $\mathrm{Sum}\left(F,k\right)=\mathrm{IndefiniteSummation}\left(F,n\right)$
 ${\sum }_{{k}}{}\left(\genfrac{}{}{0}{}{\frac{{n}}{{2}}{+}{k}}{{k}}\right){}{{2}}^{{-}{k}}{=}\frac{{n}{}\left(\genfrac{}{}{0}{}{\frac{{n}}{{2}}{+}{k}}{{k}}\right){}{{2}}^{{-}{k}}}{{2}{}\left({k}{+}{1}\right)}{+}\frac{\left({n}{+}{1}\right){}\left(\genfrac{}{}{0}{}{\frac{{n}}{{2}}{+}\frac{{1}}{{2}}{+}{k}}{{k}}\right){}{{2}}^{{-}{k}}}{{2}{}\left({k}{+}{1}\right)}$ (2)

Example 2.

 > $F≔\frac{{n}^{2}}{\mathrm{binomial}\left(2n,n\right)\left({n}^{2}+3n+2\right)}$
 ${F}{≔}\frac{{{n}}^{{2}}}{\left(\genfrac{}{}{0}{}{{2}{}{n}}{{n}}\right){}\left({{n}}^{{2}}{+}{3}{}{n}{+}{2}\right)}$ (3)
 > $\mathrm{Sum}\left(F,n\right)=\mathrm{IndefiniteSummation}\left(F,n\right)$
 ${\sum }_{{n}}{}\frac{{{n}}^{{2}}}{\left(\genfrac{}{}{0}{}{{2}{}{n}}{{n}}\right){}\left({{n}}^{{2}}{+}{3}{}{n}{+}{2}\right)}{=}{-}\frac{{4}{}\left({2}{}{n}{-}{1}\right){}\left({\prod }_{{\mathrm{_i}}{=}{1}}^{{n}{-}{1}}{}\frac{{\mathrm{_i}}{+}{1}}{{2}{}\left({2}{}{\mathrm{_i}}{+}{1}\right)}\right)}{\left({n}{+}{1}\right){}{n}}{+}\left({\sum }_{{n}}{}\frac{\left({{n}}^{{2}}{-}{14}{}{n}{+}{8}\right){}\left({\prod }_{{\mathrm{_i}}{=}{1}}^{{n}{-}{1}}{}\frac{{\mathrm{_i}}}{{4}{}{\mathrm{_i}}{+}{2}}\right)}{{2}{}{n}{+}{2}}\right)$ (4)

Examples of definite sums:

Example 1.

 > $F≔{\mathrm{binomial}\left(2n+1,2k\right)}^{2}$
 ${F}{≔}{\left(\genfrac{}{}{0}{}{{2}{}{n}{+}{1}}{{2}{}{k}}\right)}^{{2}}$ (5)
 > $\mathrm{Sum}\left(F,k=0..n\right)=\mathrm{DefiniteSummation}\left(F,k=0..n\right)$
 ${\sum }_{{k}{=}{0}}^{{n}}{}{\left(\genfrac{}{}{0}{}{{2}{}{n}{+}{1}}{{2}{}{k}}\right)}^{{2}}{=}\left(\genfrac{}{}{0}{}{{4}{}{n}{+}{1}}{{2}{}{n}}\right)$ (6)

Example 2.

 > $F≔\frac{{2}^{2k}\mathrm{\Gamma }\left(k-n\right)\mathrm{\Gamma }\left(k+n\right){z}^{k}}{\mathrm{sqrt}\left(\mathrm{\pi }\right)\mathrm{\Gamma }\left(2k+1\right)}$
 ${F}{≔}\frac{{{2}}^{{2}{}{k}}{}{\mathrm{\Gamma }}{}\left({-}{n}{+}{k}\right){}{\mathrm{\Gamma }}{}\left({k}{+}{n}\right){}{{z}}^{{k}}}{\sqrt{{\mathrm{\pi }}}{}{\mathrm{\Gamma }}{}\left({2}{}{k}{+}{1}\right)}$ (7)
 > $\mathrm{DefiniteSummation}\left(F,k=0..\mathrm{\infty }\right)$
 ${\sum }_{{k}{=}{0}}^{{\mathrm{\infty }}}{}\frac{{{2}}^{{2}{}{k}}{}{\mathrm{\Gamma }}{}\left({-}{n}{+}{k}\right){}{\mathrm{\Gamma }}{}\left({k}{+}{n}\right){}{{z}}^{{k}}}{\sqrt{{\mathrm{\pi }}}{}{\mathrm{\Gamma }}{}\left({2}{}{k}{+}{1}\right)}$ (8)

It is necessary to specify the domain of convergence:

 > $\mathrm{Sum}\left(F,k=0..\mathrm{\infty }\right)=\mathrm{DefiniteSummation}\left(F,k=0..\mathrm{\infty }\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{assuming}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{abs}\left(z\right)\le 1$
 ${\sum }_{{k}{=}{0}}^{{\mathrm{\infty }}}{}\frac{{{2}}^{{2}{}{k}}{}{\mathrm{\Gamma }}{}\left({-}{n}{+}{k}\right){}{\mathrm{\Gamma }}{}\left({k}{+}{n}\right){}{{z}}^{{k}}}{\sqrt{{\mathrm{\pi }}}{}{\mathrm{\Gamma }}{}\left({2}{}{k}{+}{1}\right)}{=}{-}\frac{\sqrt{{\mathrm{\pi }}}{}{\mathrm{cos}}{}\left({2}{}{n}{}{\mathrm{arcsin}}{}\left(\sqrt{{z}}\right)\right){}{\mathrm{csc}}{}\left({\mathrm{\pi }}{}{n}\right)}{{n}}$ (9)
 > $\mathrm{Summation}\left({k}^{\frac{3}{2}},k=1..\mathrm{\infty }\right)$
 ${\mathrm{\infty }}$ (10)
 > $\mathrm{Summation}\left({\left(-1\right)}^{k},k=1..\mathrm{\infty }\right)$
 ${\sum }_{{k}{=}{1}}^{{\mathrm{\infty }}}{}{\left({-1}\right)}^{{k}}$ (11)

Parametric case discussions may be returned:

 > $F≔\frac{\mathrm{binomial}\left(2k-3,k\right)}{{4}^{k}}$
 ${F}{≔}\frac{\left(\genfrac{}{}{0}{}{{2}{}{k}{-}{3}}{{k}}\right)}{{{4}}^{{k}}}$ (12)
 > $\mathrm{Sum}\left(F,k=0..n\right)=\mathrm{Summation}\left(F,k=0..n,\mathrm{parametric}\right)$
 ${\sum }_{{k}{=}{0}}^{{n}}{}\frac{\left(\genfrac{}{}{0}{}{{2}{}{k}{-}{3}}{{k}}\right)}{{{4}}^{{k}}}{=}\left\{\begin{array}{cc}\frac{\left(\genfrac{}{}{0}{}{{2}{}{n}{-}{1}}{{n}}\right){}\left({2}{}{n}{+}{4}\right)}{{{4}}^{{n}{+}{1}}}& {n}{\le }{0}\\ \frac{{3}}{{4}}& {n}{=}{1}\\ \frac{\left(\genfrac{}{}{0}{}{{2}{}{n}{-}{1}}{{n}}\right){}\left({2}{}{n}{+}{4}\right)}{{{4}}^{{n}{+}{1}}}{+}\frac{{3}}{{8}}& {2}{\le }{n}\end{array}\right\$ (13)
 > $\mathrm{Summation}\left(\frac{1}{k},k=a..b\right)$
 ${\sum }_{{k}{=}{a}}^{{b}}{}\frac{{1}}{{k}}$ (14)
 > $\mathrm{Summation}\left(\frac{1}{k},k=a..b,\mathrm{parametric}\right)$
 $\left\{\begin{array}{cc}{0}& {a}{=}{b}{+}{1}\\ {\mathrm{\Psi }}{}\left({b}{+}{1}\right){-}{\mathrm{\Psi }}{}\left({a}\right)& {1}{\le }{a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{0}{\le }{b}\\ {\mathrm{\Psi }}{}\left({-}{b}\right){-}{\mathrm{\Psi }}{}\left({1}{-}{a}\right)& {a}{\le }{0}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{b}{\le }{-1}\\ {\mathrm{FAIL}}& {\mathrm{otherwise}}\end{array}\right\$ (15)

If _EnvFormal is set to true, the Summation command returns the class for recognized divergent sums.

 > $\mathrm{_EnvFormal}≔\mathrm{true}$
 ${\mathrm{_EnvFormal}}{≔}{\mathrm{true}}$ (16)
 > $F≔\frac{{2}^{2k}\mathrm{\Gamma }\left(k-n\right)\mathrm{\Gamma }\left(k+n\right){z}^{k}}{\mathrm{sqrt}\left(\mathrm{\pi }\right)\mathrm{\Gamma }\left(2k+1\right)}:$
 > $\mathrm{Sum}\left(F,k=0..\mathrm{\infty }\right)=\mathrm{Summation}\left(F,k=0..\mathrm{\infty }\right)$
 ${\sum }_{{k}{=}{0}}^{{\mathrm{\infty }}}{}\frac{{{2}}^{{2}{}{k}}{}{\mathrm{\Gamma }}{}\left({-}{n}{+}{k}\right){}{\mathrm{\Gamma }}{}\left({k}{+}{n}\right){}{{z}}^{{k}}}{\sqrt{{\mathrm{\pi }}}{}{\mathrm{\Gamma }}{}\left({2}{}{k}{+}{1}\right)}{=}{-}\frac{\sqrt{{\mathrm{\pi }}}{}{\mathrm{cos}}{}\left({2}{}{n}{}{\mathrm{arcsin}}{}\left(\sqrt{{z}}\right)\right){}{\mathrm{csc}}{}\left({\mathrm{\pi }}{}{n}\right)}{{n}}$ (17)
 > $\mathrm{Summation}\left({k}^{\frac{3}{2}},k=1..\mathrm{\infty }\right)$
 ${\mathrm{\zeta }}{}\left({-}\frac{{3}}{{2}}\right)$ (18)
 > $\mathrm{Summation}\left({\left(-1\right)}^{k},k=1..\mathrm{\infty }\right)$
 ${-}\frac{{1}}{{2}}$ (19)