Hi,
On 1 September 2011 05:13, Chris Smith wrote:
> I didn't look into it. I now see:
>
> >>> Tuple(1,2,3,4,2).count(lambda i:i==2)
> 2
>
> It should probable work when receiving a simple count(2), however. I
> suspect it's because rec_find doesn't register {} (not None) as a hit.
The issue is
I didn't look into it. I now see:
>>> Tuple(1,2,3,4,2).count(lambda i:i==2)
2
It should probable work when receiving a simple count(2), however. I
suspect it's because rec_find doesn't register {} (not None) as a hit.
--
You received this message because you are subscribed to the Google Groups
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. t
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 "", line 1, in
File "sympy\core\basic.py", line 992, in count
return sum(self.find(query, group=True).values()