Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

1285: summation() documentation #1108

Merged
merged 1 commit into from

5 participants

@papriwalprateek

issue 1285 ::: documentation for summation has been done .. while examples need to be added still ..

doc/src/tutorial.txt
@@ -256,6 +256,47 @@ This will make things look better when printed. See the :ref:`printing-tutorial`
section below. If you have a unicode font installed, you can pass
use_unicode=True for a slightly nicer output.
+Summation
+=========
@scolobb
scolobb added a note

I think this section should be demoted to a subsection of the Calculus section, because I can see that the subsection about series expansion is already there. Perhaps, this bit of documention should go right after the description of series expansion (which starts at line 382).

The developers have the ultimate word, of course.

@asmeurer Owner
asmeurer added a note

I agree with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
doc/src/tutorial.txt
@@ -256,6 +256,47 @@ This will make things look better when printed. See the :ref:`printing-tutorial`
section below. If you have a unicode font installed, you can pass
use_unicode=True for a slightly nicer output.
+Summation
+=========
+
+ Compute the summation of f with respect to symbols.
+
+ The notation for symbols is similar to the notation used in Integral.
@scolobb
scolobb added a note

I think this line does not belong to the tutorial, at least not this early. Also, it doesn't help a person who wants to get started, IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
doc/src/tutorial.txt
((7 lines not shown))
+ Compute the summation of f with respect to symbols.
+
+ The notation for symbols is similar to the notation used in Integral.
+ 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 returns an unevaluated Sum object.
@scolobb
scolobb added a note

I think this sentence should be reformulated to better fit the style of a tutorial. For example: "If it cannot compute the sum, it prints the corresponding summation formula."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
doc/src/tutorial.txt
@@ -919,5 +960,6 @@ This tutorial is also available in other languages:
.. toctree::
:maxdepth: 1
+ tutorial.bg.txt
+ tutorial.cs.txt
@scolobb
scolobb added a note

These two lines seem to introduce changes that are unrelated to the enhancement you provide, so they should at least belong to a different commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
doc/src/tutorial.txt
((6 lines not shown))
tutorial.ru.txt
-
@scolobb
scolobb added a note

You should normally try to not produce such empty line modifications. Usually, such things are fixed in separate, catch-all clean-up commits.

@asmeurer Owner
asmeurer added a note

It's not that big of a deal :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
doc/src/tutorial.txt
((27 lines not shown))
+ >>> from sympy import summation, oo, symbols, log
+ >>> i, n, m = symbols('i n m', integer=True)
+
+ >>> summation(2*i - 1, (i, 1, n))
+ n**2
+ >>> summation(1/2**i, (i, 0, oo))
+ 2
+ >>> summation(1/log(n)**n, (n, 2, oo))
+ Sum(log(n)**(-n), (n, 2, oo))
+ >>> summation(i, (i, 0, n), (n, 0, m))
+ m**3/6 + m**2/2 + m/3
+
+ >>> from sympy.abc import x
+ >>> from sympy import factorial
+ >>> summation(x**n/factorial(n), (n, 0, oo))
+ exp(x)
@asmeurer Owner
asmeurer added a note

I think this shouldn't be here.

but i did as said by scolobb ..

he said to demote the summation documentation to calculus after sub section(series expansion).

@scolobb
scolobb added a note

Aaron, why do you think it shouldn't be here? It's a very nice and simple example, IMHO.

Prateek, I believe Aaron doesn't refer to the location of the whole section, but rather to the fact that some of the examples shouldn't be included in the tutorial.

ok u mean examples such as which include factorial,exp() functions .... may be including these functions in this tutorial is not good ...

@asmeurer Owner
asmeurer added a note

No, I was referring to a line that seems to be gone now. GitHub left my comment for some reason. You can ignore this comment now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@papriwalprateek

SymPy Bot Summary: There were test failures.

@papriwalprateek: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYveIODA

Interpreter: /usr/bin/python (2.7.1-final-0)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 5135035
branch hash: 6bbc588

Automatic review by SymPy Bot.

@papriwalprateek

please see to Sympy-bot results ...

@asmeurer
Owner

You just need to change the example output to give the pretty printed output, since we initialize the pretty printer at the top of the tutorial.

@papriwalprateek

SymPy Bot Summary: All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY3oEPDA

Interpreter: /usr/bin/python (2.7.1-final-0)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 5135035
branch hash: 44b32e85057970b2f8abe656af4701f0168ec54f

Automatic review by SymPy Bot.

@papriwalprateek

all tests passed ...

doc/src/tutorial.txt
@@ -414,6 +414,58 @@ Another simple example::
y 2 3 4 5
y y y y
+
+
+.. index:: summation
+
+Summation
+---------
+
+Compute the summation of f with respect to symbols.
+
+ summation(f, (i, a, b)) computes the sum of f with respect to i from a to b,
+ i.e.,
+
+ ::
+
@smichr Collaborator
smichr added a note

you might want to copy and paste the output from pprint(Sum(f,(i,a,b))) to make sure it looks right; what you have below is not right. Notice that the tic on the upper bar is not at the end of the bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
doc/src/tutorial.txt
((11 lines not shown))
+Compute the summation of f with respect to symbols.
+
+ 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 symbols tuples::
@smichr Collaborator
smichr added a note

symbols tuples -> limits

means?

@scolobb
scolobb added a note

I think Chris means that you should say "by introducing additional limits" instead of "by introducing additional symbols tuples".

ok ... right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@smichr smichr commented on the diff
doc/src/tutorial.txt
@@ -414,6 +414,58 @@ Another simple example::
y 2 3 4 5
y y y y
+
+
+.. index:: summation
+
+Summation
+---------
@smichr Collaborator
smichr added a note

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

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

@scolobb
scolobb added a note

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
doc/src/tutorial.txt
@@ -414,6 +414,58 @@ Another simple example::
y 2 3 4 5
y y y y
+
+
+.. index:: summation
+
+Summation
+---------
+
+Compute the summation of f with respect to symbols.
@smichr Collaborator
smichr added a note

symbols -> the given summation variable over the given limits (or words to that effect)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jrioux
Collaborator

Passes python 2.7 64-bit tests and doctests. Looks good to me.

@smichr
Collaborator

Following the convention of the preceding documentation, text should be at the left margin and examples prefixed with >>> should be indented 4 spaces. (Right now all the text is indented at the same level as the interactive input/output.)

@asmeurer
Owner

SymPy Bot Summary: There were test failures.

@papriwalprateek: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYnewQDA

Interpreter: /usr/local/bin/python2.5 (2.5.0-final-0)
Architecture: Darwin (32-bit)
Cache: yes
Test command: setup.py test
master hash: 92c3c40
branch hash: 006f1d9

Automatic review by SymPy Bot.

@asmeurer
Owner

SymPy Bot Summary: All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYs-QQDA

Interpreter: /Library/Frameworks/Python.framework/Versions/3.2/bin/python3 (3.2.2-final-0)
Architecture: Darwin (64-bit)
Cache: yes
Test command: setup.py test
master hash: 92c3c40
branch hash: 006f1d9

Automatic review by SymPy Bot.

@papriwalprateek

do i now need to make any furthur changes ..

@jrioux
Collaborator

@asmeurer Please look at the failed tests. I still think there is a problem with your testing machine.

@papriwalprateek

i guess the second sympy bot tests were the correct one ..

@jrioux
Collaborator

Passes doctests and tests on 32- and 64-bit python 2.7.0, +1

@papriwalprateek

i think it can be merged ...

@smichr smichr merged commit fae2274 into sympy:master
@smichr
Collaborator

Thanks, this is in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 25, 2012
  1. @papriwalprateek
This page is out of date. Refresh to see the latest.
Showing with 56 additions and 0 deletions.
  1. +56 −0 doc/src/tutorial.txt
View
56 doc/src/tutorial.txt
@@ -414,6 +414,62 @@ Another simple example::
y 2 3 4 5
y y y y
+
+
+
+
+.. index:: summation
+
+Summation
+---------
@smichr Collaborator
smichr added a note

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

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

@scolobb
scolobb added a note

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+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
Something went wrong with that request. Please try again.