Comment #49 on issue 2607 by smi...@gmail.com: as_numer_denom() is too slow http://code.google.com/p/sympy/issues/detail?id=2607
I think it's best to leave the structural gcd out of the as_numer_denom method. Let each method do one thing well. The only thing I have found to be worth doing is multiplying by the LCM to clear the coefficients from the denominators so they can perhaps be collected under a common denominator. This would help things like `Sum(x**j/j!).as_numer_denom()` return about 7X faster. When all denominators are the same the precollection returns as fast as possible -- much faster than the current implementation.
I don't know of any other way to return quickly other than not doing the multiplication, i.e. by returning a nested numerator. This is good if you are only interested in the denominator...but I imagine that to do anything with the numerator you are going to want to expand it. But perhaps this is a good compromise: you get an answer quickly and only need to pay "lazily" for the numerator if and when you need it.
What would you like to do? I think the preprocessing is a safe addition. -- 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.