sum - Maple Programming Help

sum

definite and indefinite symbolic summation

Calling Sequence

 sum(f, k) $\sum _{k}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}f$ sum(f, k=m..n) $\sum _{k=m}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}f$

Parameters

 f - expression k - name; summation index m, n - integers or arbitrary expressions

Basic Information

Description

 • The sum command (sum) is for symbolic summation.
 • You can enter the command sum using either the 1-D or 2-D calling sequence.  For example, sum(k^2,k) is equivalent to $\sum _{k}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}{k}^{2}$.

Output

 • Computes a closed form for a sum.
 • Maple returns the call unevaluated if it cannot find a closed form.

Note

 • To add a finite sequence of values, rather than compute a formula, use the add command.  For example, add(k, k=0..9) returns 45.  Although the sum command can often be used to compute explicit sums, it is strongly recommended that the add command be used in programs if an explicit sum is needed, in particular, when summing over all elements of a list, Array, Matrix, or similar data structure.

Examples

Typical Examples

 > $\sum _{k}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}{k}^{2}$
 $\frac{{1}}{{3}}{}{{k}}^{{3}}{-}\frac{{1}}{{2}}{}{{k}}^{{2}}{+}\frac{{1}}{{6}}{}{k}$ (1)
 > $\sum _{k=0}^{n-1}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}k$
 $\frac{{1}}{{2}}{}{{n}}^{{2}}{-}\frac{{1}}{{2}}{}{n}$ (2)
 > $\sum _{k=0}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}\left(k+1\right)$
 $\frac{{1}}{{2}}{}{\left({n}{+}{1}\right)}^{{2}}{+}\frac{{1}}{{2}}{}{n}{+}\frac{{1}}{{2}}$ (3)
 > $\sum _{k=0}^{\mathrm{∞}}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}\frac{1}{k!}$
 ${ⅇ}$ (4)

To add a finite sequence of values, the add command can be used.

 > $\sum _{k=0}^{6}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}\left(k+1\right)$
 ${28}$ (5)
 > $\mathrm{add}\left(k+1,k=0..6\right)$
 ${28}$ (6)

Classical Telescoping

 > $\sum _{k=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}\mathrm{binomial}\left(2n-2k,n-k\right){2}^{4k}{\left(2k\left(2k+1\right)\mathrm{binomial}\left(2k,k\right)\right)}^{-1}$
 ${-}\frac{{4}{}{\mathrm{binomial}}{}\left({2}{}{n}{-}{2}{,}{n}{-}{1}\right){}\left({-}{2}{}{n}{+}{1}\right)}{{2}{}{n}{+}{1}}$ (7)

Details

 For detailed information including:
 • Complete description of all parameters
 • Complete description of functionality including indefinite summation and the inert form, Sum
 • Details and examples comparing sum and add commands
 see the sum/details help page.

Compatibility

 • The sum command was updated in Maple 15; see Enhancements to Computational Algorithms in Maple 15.
 • The sum command was updated in Maple 2016; see Advanced Math.