Comment #6 on issue 1374 by akshaysrinivasan: simplify(x**2-x**2.0) does not yield 0. http://code.google.com/p/sympy/issues/detail?id=1374
I tried this tweak: diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py index f9cc5f2..ae8dc7e 100644 --- a/sympy/core/numbers.py +++ b/sympy/core/numbers.py @@ -240,6 +240,9 @@ class Real(Number): __slots__ = ['_mpf_', '_prec'] # mpz can't be pickled + def __hash__(self): + return hash(float(self)) + def __getnewargs__(self): return (mlib.to_pickable(self._mpf_),) @@ -761,6 +764,9 @@ class Integer(Rational): __slots__ = ['p'] + def __hash__(self): + return hash(int(self)) + def _as_mpf_val(self, prec): return mlib.from_int(self.p) and now it automatically converts the Real into an Integer. >>> x**2.0 x**2 How is this ? -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to sympy-issues@googlegroups.com To unsubscribe from this group, send email to sympy-issues+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en -~----------~----~----~----~------~----~------~--~---