These are chat archives for symengine/symengine

3rd
Feb 2016
Ralf Stephan
@rwst
Feb 03 2016 08:13
@isuruf When the case C is given a second time, caching reduces it to 2.8s which appears to be spent in flattening of the Add. Can't we do that in SymEngine?
However, the greater chunk is the 6.3s which is cached.
Ralf Stephan
@rwst
Feb 03 2016 08:20
Ah the 6.3s is in Order.contains as well...
Ralf Stephan
@rwst
Feb 03 2016 08:45
        if not options.pop('evaluate', global_evaluate[0]):
            return cls._from_args(args)
If we'd just set evaluate to False temporarily for creation this all could be avoided.
Isuru Fernando
@isuruf
Feb 03 2016 08:52
Add(*t, evaluate=False) ?
Ralf Stephan
@rwst
Feb 03 2016 08:53
Yes, case C is now 1.9s
and 20ms for B!
But it must be evaluated eventually because if I do _+1 after the series is output it returns me 1+x+x^2+O(x^1000)
Isuru Fernando
@isuruf
Feb 03 2016 09:00
What's wrong with that?
Ralf Stephan
@rwst
Feb 03 2016 09:01
The other 997 or so terms are missing
Isuru Fernando
@isuruf
Feb 03 2016 09:01
Ah
I get this
In [10]: Add(*t, evaluate=False) + x
Out[10]: 1 + 2*x + x**2 + x**3 + x**4 + x**5 + x**6 + x**7 + x**8 + x**9 + x**10 + x**11 + x**12 + x**13 + x**14 + x**15 + x**16 + x**17 + x**18 + x**19 + x**20 + x**21 + x**22 + x**23 + x**24 + x**25 + x**26 + x**27 + x**28 + x**29 + x**30 + x**31 + x**32 + x**33 + x**34 + x**35 + x**36 + x**37 + x**38 + x**39 + x**40 + x**41 + x**42 + x**43 + x**44 + x**45 + x**46 + x**47 + x**48 + x**49 + x**50 + x**51 + x**52 + x**53 + x**54 + x**55 + x**56 + x**57 + x**58 + x**59 + x**60 + x**61 + x**62 + x**63 + x**64 + x**65 + x**66 + x**67 + x**68 + x**69 + x**70 + x**71 + x**72 + x**73 + x**74 + x**75 + x**76 + x**77 + x**78 + x**79 + x**80 + x**81 + x**82 + x**83 + x**84 + x**85 + x**86 + x**87 + x**88 + x**89 + x**90 + x**91 + x**92 + x**93 + x**94 + x**95 + x**96 + x**97 + x**98 + x**99 + O(x**101)
Ralf Stephan
@rwst
Feb 03 2016 09:03
Yes sorry I had a devel version on top of sympy/sympy#10513
With SymPy master it's slow again. With that PR it's 1.9s for C if you suppress output. But then _=_+1 will evaluate and need 7.5s more
So we can at least move it to a later time.
Isuru Fernando
@isuruf
Feb 03 2016 16:37
@rwst, _ = _ + 1 will invoke the Gruntz algorithm again