On Sep 15, 10:56 am, Mark Dewing <markdew...@gmail.com> wrote:
> Is there a reason that limits for sums and integrals are stored
> differently?
>
> For integrals, it appears to be (variable, (lower_limit, upper_limit))
> and for sums it appears to be (variable, lower_limit, upper_limit)

Maybe because if the Integral limits are stored as a flat tuple then
you have to look at two quantities after the integration variable to
see what you are dealing with whereas if you store it as a nested
tuple you know what you are dealing with by just looking at the second
item:
 - if it is None it is an unevaluated Integral like Integral(x)
 - if it is a Tuple, one or both of the upper and lower limits are not
None

The same semantics don't apply to a Sum which is discrete. One can't
do a sum without knowing the limits in the same way you can do an
integral without the limits. So you always need lower and upper limits
even though this is not enforced (and should probably be changed:

>>> Sum(x,(x,1))
Sum(x, (x, 1))
>>> _.doit()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy\concrete\summations.py", line 67, in doit
    for i, a, b in self.limits:
ValueError: need more than 2 values to unpack

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to