I'm pretty sure you are aware of this, but count is actually a method of Expr. Not sure how to use it, though:

In [3]: sin(2*x).count(S(2))
Out[3]: 0

In [6]: sin(2*x).count(x)
Out[6]: 0

...

On 01.09.2011 06:07, smichr wrote:
Is there a nice way to get Tuple to inherit tuple's methods? e.g. the
count fails:

a=Tuple(1,2,3,2)
a.count(S(2))
0
a.count(2)
Traceback (most recent call last):
   File "<stdin>", line 1, in<module>
   File "sympy\core\basic.py", line 992, in count
     return sum(self.find(query, group=True).values())
   File "sympy\core\basic.py", line 975, in find
     rec_find(self)
   File "sympy\core\basic.py", line 969, in rec_find
     if _query(expr):
TypeError: 'int' object is not callable


--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@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