Summation of function

80 views
Skip to first unread message

Gaurav Dhingra

unread,
Jan 22, 2015, 8:56:02 PM1/22/15
to sy...@googlegroups.com
Hi all

I ran the following the following code

In[10]: simplify(summation((k), (k, 2, 4.7))) == simplify(summation((k), (k, 2, 4.4)))
Out[10]: False

I read the documentation of summation function, so according to it the summation includes all the integer values from start to end. But does not seem to follow it.

Is this a bug. ?

Aaron Meurer

unread,
Jan 22, 2015, 10:06:18 PM1/22/15
to sy...@googlegroups.com
See https://github.com/sympy/sympy/issues/5822 for a discussion on this. I'm not sure what convention SymPy should take, but the documentation ought to match it.

Aaron Meurer

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/697cda0a-62db-411e-bf10-a9d601bbcb69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gaurav Dhingra

unread,
Feb 3, 2015, 3:01:59 AM2/3/15
to sy...@googlegroups.com
Hi,
I want to know about the "summation" function used in sympy.

The code should be according to the documentation but for summation, As @asmeurer had mentioned earlier to me that- "he is not sure regarding the summation function. That what sympy should be doing with it."

Right now the documentation does not match with the way summation is done right now.

I guess we have choices for implementing the summation function(which i am noticing are the same as Aaron mentioned in issue #5822 https://github.com/sympy/sympy/issues/5822)

1. Following the way as the documentation says "taking
    all integer values from ``start`` through ``end``".
    which implies summation like 
    summation(exp(a*x), (x, 1.2, 1.5)) would result in a value of zero. (since no integer value is included between 1.2 and 1.5)
    I think this would not be the best way to go. As the this would result in many function summation to result in a value even if the summation should not exist.

2. Following the way sympy is going right now i.e evaluate the the summation for general expression and than substituting the value of lower and upper limit. (I don't think it would be a good way to go.)

3. Following the way the Wolfram Alpha is doing i.e evaluating making the lower limit not to be a fraction for evaluating the summation.

I would like to work on the issue #5822 . 

Christophe Bal

unread,
Feb 3, 2015, 3:07:36 AM2/3/15
to sympy-list
Hello.

summation(exp(a*x), (x, 1.2, 1.5)) = 0 because a summation with an empty set of indices k is zero by convention. This allows to say that summation over disjoint set A and B is the summation over their union.

Maybe sympy should avoid the use of non integers for the lower and upper bounds.


Christophe BAL
Enseignant de mathématiques en Lycée et développeur Python amateur
---
French math teacher in a "Lycée" and Python amateur developer

Gaurav Dhingra

unread,
Feb 3, 2015, 3:11:44 AM2/3/15
to sy...@googlegroups.com
What i noticed is- what Aaron mentioned "As Mathematica or Maple have no problems with this why should it be forbidden or not working nicely in Sympy?" and i too think it would be better to have summation over non-integers as it is used in Physics.

Christophe Bal

unread,
Feb 3, 2015, 3:13:42 AM2/3/15
to sympy-list
Ok. In that case, summation(exp(a*x), (x, 1.2, 1.5)) = 0 is a normal feature.


Christophe BAL
Enseignant de mathématiques en Lycée et développeur Python amateur
---
French math teacher in a "Lycée" and Python amateur developer

Aaron Meurer

unread,
Feb 3, 2015, 2:18:58 PM2/3/15
to sy...@googlegroups.com
Do physics applications actually use summation notation with noninteger limits? If so, what convention do they use?

Aaron Meurer

Gaurav Dhingra

unread,
Feb 3, 2015, 2:31:49 PM2/3/15
to sy...@googlegroups.com
@asmeurer. I only know they are used in summing the "half-integer" spins. But i have no idea regarding the rules used.

Francesco Bonazzi

unread,
Feb 3, 2015, 2:52:56 PM2/3/15
to sy...@googlegroups.com

On Tuesday, February 3, 2015 at 8:18:58 PM UTC+1, Aaron Meurer wrote:
Do physics applications actually use summation notation with noninteger limits? If so, what convention do they use?

Summing over the states of fermions. But that's a convention.
 
@asmeurer. I only know they are used in summing the "half-integer" spins. But i have no idea regarding the rules used.

Spins are usually half-integers in spacetime, but I know of some special cases, like propagation on waves on 2D surfaces, where one may build a theory with any rational spin quasi-particles, or something like that.

Sometimes people with a background in mathematics get really scared when they see how mathematics is used in physics. The funniest I can think of is that multiple summations and integrals are often silently assumed to commute, even if they sum over to infinity.

Aaron Meurer

unread,
Feb 3, 2015, 6:41:45 PM2/3/15
to sy...@googlegroups.com
But do they actually use summation convention, as if i=0.5..2.5 meant i = 0.5, 1.5, 2.5?

I guess you make a good point, in that I wouldn't completely trust it even if they did, because I doubt physicists would have thought through all the mathematical implications of choosing that convention, which is something that we do need to care about. 

Aaron Meurer
 
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

Francesco Bonazzi

unread,
Feb 4, 2015, 4:57:42 PM2/4/15
to sy...@googlegroups.com


On Wednesday, February 4, 2015 at 12:41:45 AM UTC+1, Aaron Meurer wrote:

But do they actually use summation convention, as if i=0.5..2.5 meant i = 0.5, 1.5, 2.5?

A spin state is usually represented by an N-dim vector, upon which act NxN matrices. The energies associated with these N entries correspond to N/2 to -N/2 times the reduced Planck constant. Sometimes, especially in the bra-ket notation, instead of using integers, one just uses the multiplication factor to the reduced Planck constant for the energies of those states as index, which may also appear in a sum. There are negative values, and if N is odd, they are half-integer.
Reply all
Reply to author
Forward
0 new messages