Issue 1179: Sum.__str__() and Sum.doit with no explicit limits fails
http://code.google.com/p/sympy/issues/detail?id=1179

Comment #2 by andy.terrel:
opps I should have run some test on that bug fix (I deleted the last  
comment).  My two minute fix would just cover up problems instead of fix  
them.

Its more broken than just that:

In [16]: s = Sum(f(i,k),(i,0,5),(k,0,2))

In [17]: s
Out[17]: Sum(f(i, k), (i, 0, 5))

But then digging deeper into the code it seems that Sum.doit can't handle  
unbound functions.

In [2]: s = Sum(cos(z),z)

In [3]: s.doit()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/usr/local/src/<ipython console> in <module>()

/usr/local/src/sympy/sympy/concrete/summations.py in doit(self, **hints)
      66         #    return self
      67         f = self.function
---> 68         for i, a, b in self.limits:
      69             f = eval_sum(f, (i, a, b))
      70             if f is None:

TypeError: 'Symbol' object is not iterable


This should work exactly like Integrals but for some reason the code is a  
lot different for the two.  I would say that this points out that Sum needs  
to be refactored, and possibly Integral.

Does anyone know what a limit with only 2 arguments is suppose to be?  For  
example:

In [5]: s = Sum(cos(z),(z,1))

In [6]: s
Out[6]: Sum(cos(z), (z, 1))

In [7]: s.doit()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/usr/local/src/<ipython console> in <module>()

/usr/local/src/sympy/sympy/concrete/summations.py in doit(self, **hints)
      66         #    return self
      67         f = self.function
---> 68         for i, a, b in self.limits:
      69             f = eval_sum(f, (i, a, b))
      70             if f is None:

ValueError: need more than 2 values to unpack

And then there is the need to fix when the limit is an equality....

-- Andy


Issue attribute updates:
        Summary: Sum.__str__() and Sum.doit with no explicit limits fails
        Status: Accepted
        Labels: -NeedsReview

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to