Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing an unevaluated Sum in Add can be unexpectedly slow #17911

Open
ethankward opened this issue Nov 15, 2019 · 1 comment
Open

Printing an unevaluated Sum in Add can be unexpectedly slow #17911

ethankward opened this issue Nov 15, 2019 · 1 comment

Comments

@ethankward
Copy link
Contributor

>>> from sympy import *
>>> from sympy.abc import q, z, n
>>> f1 = lambda z, q: -log(1 - q)
>>> f2 = lambda z, q: log(q) * Sum(q**(n + z) / (1 - q**(n + z)), [n, 0, oo])
>>> f1(z, q)
-log(1 - q)
>>> f2(z, q)
log(q)*Sum(q**(n + z)/(1 - q**(n + z)), (n, 0, oo))
>>> f1(z, q) + f2(z, q)
log(q)*Sum(q**(n + z)/(1 - q**(n + z)), (n, 0, oo)) - log(1 - q)
>>> f1(3, 4)
-log(3) - I*pi
>>> f2(3, 4)
log(4)*Sum(4**(n + 3)/(1 - 4**(n + 3)), (n, 0, oo))
>>> f1(3, 4) + f2(3, 4)
log(4)*Sum(4**(n + 3)/(1 - 4**(n + 3)), (n, 0, oo)) - log(3) - I*pi

The last line takes about 30 seconds.

@asmeurer
Copy link
Member

Likely just a instance of #10800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants