# 1285: summation() documentation #1108

Merged
merged 1 commit into from Apr 16, 2012
Commits
Failed to load files and symbols.
+56 −0
@@ -414,6 +414,62 @@ Another simple example::
y 2 3 4 5
y y y y
+
+
+
+
+.. index:: summation
+
+Summation
+---------

#### smichr Mar 9, 2012

Member

check other examples -- is this suppose to be single or double underlined?

#### papriwalprateek Mar 10, 2012

Contributor

i think it should be single underlined only as with the other examples given in tutorial.txt ..

#### scolobb Mar 10, 2012

Contributor

Double underline seems to be for sections, while single underline -- for subsections. This bit about summation is now a subsection of the Calculus section (as far as I remember), so it should be single underlined.

+
+Compute the summation of f with respect to the given summation variable over the given limits.
+
+summation(f, (i, a, b)) computes the sum of f with respect to i from a to b,
+i.e.,
+
+::
+
+
+ b
+ ____
+ \ `
+summation(f, (i, a, b)) = ) f
+ /___,
+ i = a
+
+
+If it cannot compute the sum, it prints the corresponding summation formula.
+Repeated sums can be computed by introducing additional limits::
+
+ >>> from sympy import summation, oo, symbols, log
+ >>> i, n, m = symbols('i n m', integer=True)
+
+ >>> summation(2*i - 1, (i, 1, n))
+ 2
+ n
+ >>> summation(1/2**i, (i, 0, oo))
+ 2
+ >>> summation(1/log(n)**n, (n, 2, oo))
+ oo
+ ___
+ \ `
+ \ -n
+ / log (n)
+ /__,
+ n = 2
+ >>> summation(i, (i, 0, n), (n, 0, m))
+ 3 2
+ m m m
+ -- + -- + -
+ 6 2 3
+ >>> from sympy.abc import x
+ >>> from sympy import factorial
+ >>> summation(x**n/factorial(n), (n, 0, oo))
+ x
+ e
+
+
.. index:: integration
Integration