These are chat archives for symengine/symengine
sAdd, 1.75s in symengine
OK, I made the statement because I can consistently interrupt computation of case C in this part:
/usr/lib/python2.7/site-packages/sympy-0.7.7.dev0-py2.7.egg/sympy/core/numbers.pyc in __div__(self, other) 1402 return S.ComplexInfinity 1403 else: -> 1404 return Rational(self.p*other.q, self.q*other.p) 1405 elif isinstance(other, Float): 1406 return self*(1/other)
/usr/lib/python2.7/site-packages/sympy-0.7.7.dev0-py2.7.egg/sympy/core/sympify.pyc in sympify(a, locals, convert_xor, strict, rational, evaluate) 263 264 try: --> 265 return a._sympy_() 266 except AttributeError: 267 pass symengine_wrapper.pyx in symengine.lib.symengine_wrapper.Rational._sympy_ (/home/ralf/symengine.py/symengine/lib/symengine_wrapper.cpp:17854)()
but I agree the way I came to my conclusion was fishy
series(1/(1-x),x,0,1000,...)should then be about 1.25s? I have only 380ms.
sAdddo that takes 800ms more if we have rationals instead of 1, and if it uses gmpy?
sAddtakes more time
mpmathdoesn't use gmpy's mpq type. Let me check if there's a way
diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py index d11ba4b..c944977 100644 --- a/sympy/core/numbers.py +++ b/sympy/core/numbers.py @@ -1388,7 +1388,11 @@ def __sub__(self, other): @_sympifyit('other', NotImplemented) def __mul__(self, other): - if isinstance(other, Rational): + if self is S.One: + return other + elif other is S.One: + return self + elif isinstance(other, Rational): return Rational(self.p*other.p, self.q*other.q) elif isinstance(other, Float): return other*self