Comment #28 on issue 683 by asmeurer: speedup of sum(x**i/i,i=1..400)
http://code.google.com/p/sympy/issues/detail?id=683

Add(*args) is efficient only when there is no relationship between elements of args.

I thought it was the opposite, that it's especially more efficient when things cancel or combine. How does something like sum([randint(-2, 2)*x for i in xrange(1000)]) compare to Add(*[randint(-2, 2)*x for i in xrange(1000)]) in your branch?

I started with Add, but the same has to be done with Mul. Just Add case is much simpler to experiment with, because Add.flatten() is much simpler than Mul.flatten() and you don't have to deal so much with non-commutative objects.

Not just that, but also power combining, which is basically the same logic as Add.flatten. You also have to combine numerical bases, so that sqrt(6)*sqrt(2) => 2*sqrt(3).

Also, Mul.flatten has a lot more junk relating to things like oo, nan, O, etc. that really should be factored out (issue 1941).

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