Comment #1 on issue 2346 by [email protected]: Symbols should only be equal if they have the same assumptions
http://code.google.com/p/sympy/issues/detail?id=2346

It's easy to add the right check in Basic.__eq__ (self._assume_type_keys == other._assume_type_keys), but then, here's the kind of things that happen:

In [1]: limit(sin(x)/x, x, 2)
Out[1]:
sin(2)
──────
  2

In [3]: sin(2)/2
Out[3]:
sin(2)
──────
  2

In [5]: _1 == _3
Out[5]: False

In [15]: _3.args
Out[15]: (1/2, sin(2))

In [16]: [x.assumptions0 for x in _3.args]
Out[16]: [{}, {}]

In [17]: [x.assumptions0 for x in _1.args]
Out[17]:
[{}, {bounded: True, commutative: True, complex: True, imaginary: False, negative: False, nonnegative: True, nonpositive: False, nonzero: True, positive: True, real: True, unbounded: False, zero: False}]

What happens is that during the computation of the limit, a sin is instantiated with assumptions already set, which messes with the hash. It doesn't make sense anyway to set assumptions on a composite object - they should be derived from the assumptions set on its parts. So I think that calls like Add(..., **assumptions) should be disallowed and Basic.new, whose sole use is to make it easy to make such calls, should be removed.

--
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