Comment #12 on issue 2607 by asmeurer: as_numer_denom() is too slow
http://code.google.com/p/sympy/issues/detail?id=2607

I think I tried to speed up that loop by computing the product once and divide through by each denominator and it ended up being slower than the present approach

I can't imagine how, but I'll go ahead and code this one up when I do the benchmarks.

I can't tell from your notation what you mean exactly in comment 7. Do you mean

Yeah. The idea is to iteratively compute

(a1*d2 + a2*d1)/(d1*d2)

(a1*d2*d3 + a2*d1*d3 + a3*d1*d2)/(d1*d2*d3)

...

And being clever enough to reuse the multiplication you computed in the denominator of the previous step for the new term in the numerator (e.g., only compute d1*d2 once, in step 1, and reuse it in step 2 for the a3*d1*d2 and d1*d2*d3 parts). I believe that if you preparse common denominators together as Ronan suggests and then do this, it will be the most efficient, though only the timings will tell.

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