Updates:
        Status: Valid

Comment #1 on issue 4089 by [email protected]: Matrix object does not accept being summed when inside a list and using built-in sum()
http://code.google.com/p/sympy/issues/detail?id=4089

It's because sum(s) results in 0 + s[0] + s[1] + s[2].

But try this patch:

diff --git a/sympy/matrices/matrices.py b/sympy/matrices/matrices.py
index ab16975..d74dad9 100644
--- a/sympy/matrices/matrices.py
+++ b/sympy/matrices/matrices.py
@@ -575,6 +575,8 @@ def __add__(self, other):
             for i in range(A.shape[0]):
                 ret[i] = list(map(lambda j, k: j + k, alst[i], blst[i]))
             return classof(A, B)._new(ret)
+        if S(other).is_zero:
+            return self
         raise TypeError('cannot add matrix and %s' % type(other))

     def __radd__(self, other):


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to