On Tue, Apr 23, 2013 at 9:30 AM, Ronan Lamy <ronan.l...@gmail.com> wrote: > Le 22/04/2013 10:27, Tom Bachmann a écrit : > > >> I attach the output. Here is my reading: >> >> - simplify spends 70% in together and powsimp >> - together spends 99% in object creation >> - powsimp spends 95% in object creation >> - AssocOp.__new__ spends 90% in flatten >> - flatten has now obvious hotspot >> >> What I can see is that flatten spends considerable amounts of time in >> things which recursively call flatten *again* (i.e. things like a *= b). >> This seems to indicate that it can probably benefit from memoization >> caching. > > > Memoization won't achieve anything, Mul is already cached. We need to find a > way to avoid O(n) operations (like <Mul> *= b) in the first place. Also, > Mul.flatten does way too many things and has way too many special cases. > Rational powers simplification shouldn't be done there and things like I * > zoo shouldn't have to go through Mul.flatten.
For rational power simplification, I assume you mean Rational**Rational. What would you suggest doing with this? I suppose we could leave it unsimplified by default, though this would be annoying in trivial cases (like sqrt(16), or sqrt(12)*sqrt(3)). Anyway, wouldn't that whole logic be skipped if the expression doesn't contain a nontrivial rational power? Aaron Meurer > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > Visit this group at http://groups.google.com/group/sympy?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.