The function count_ops (in sympy/core/function.py) fails for expression
involving MatrixSymbol and indexing (e.g. M[0,0] + 1). Following is the
program that reproduces the bug:
>>> from sympy import *
>>> M = MatrixSymbol('M', 7, 7)
>>> count_ops(M[0,0] + 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sympy/core/function.py", line 2290, in count_ops
if a.is_Rational:
AttributeError: 'str' object has no attribute 'is_Rational'
Cause: MatrixSymbol M has is_Symbol equal False. Hence, count_ops continues
to examine M.args (as in the code block
https://github.com/sympy/sympy/blob/7163137e22fbefbb645147a15147b26dad220d49/sympy/core/function.py#L2352-L2353
).
Also, M.args contains the string which is the name of the symbol, causing
the failure when count_ops considers it in the next while-loop iteration
(which is the string and has no is_Rational attribute)
--
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 [email protected].
To post to this group, send email to [email protected].
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/a0401003-699c-46bf-9773-7b4af414ff99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.