Comment #28 on issue 2607 by asmeurer: as_numer_denom() is too slow
http://code.google.com/p/sympy/issues/detail?id=2607
for a few examples I tried, together() is only a few percent slower than
as_numer_denom4()
Not quite:
In [4]: numers, denoms = zip(*((Symbol('n%d'%i),Symbol('d%d'%i)) for i in
xrange(1000)))
In [5]: a = Add(*(n/d for n, d in zip(numers, denoms)))
In [6]: %timeit together(a)
1 loops, best of 3: 27.8 s per loop
But I see now that together() and as_numer_denom() do basically the same
thing, and one should call the other. Logically, the main code should be
in as_numer_denom(), which keeps things separate and is implemented OO.
together() should just wrap this in a nice way and provide the deep
functionality. Does together() make any other promises about the
structure of the output that I should be aware of? For example, will
automatically canceling simple terms gcds be fine?
This is similar to the change I made to as_real_imag and
expand(complex=True) back in issue 1985, where I put the core logic in
as_real_imag, the function that keeps things separate, rather than having
the core logic in expand(complex=True) and trying to pull it apart again,
which was broken. This is more or less exactly the same sort of thing,
only here we want to keep the numerator and denominator separate during
core computation rather than real and imaginary parts.
--
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.