Comment #6 on issue 3793 by asmeu...@gmail.com: Integrate hangs
http://code.google.com/p/sympy/issues/detail?id=3793
It's because when you expand, there are fewer terms in each trig function
(because for example, something like sin(pi*(x - 1)) goes to sin(pi*x -
pi), which is transformed to -sin(pi*x)).
heurisch seems very poorly optimized for things like sin(pi*(x - 1)). I
think it's because at line 244 of heurisch.py, cancel() is called on the
derivative, meaning that the derivative of sin(pi*(x - 1)) is in terms of
cos(pi*x) instead of cos(pi*(x - 1)), and it later has a hard time
recognizing the two as being derivatives on one another.
I guess what really should happen is that cancel() should also be called on
the original f (line 187 or thereabouts). Or something like terms =
set([cancel(i) for i in terms]) before line 243. I'm not sure if this will
be a performance hit, in the general case, though. It's worth playing
around with it and benchmarking it, though. I can confirm that changing
line 187 to terms = components(cancel(f), x) causes all of the integrals
from this issue to return instantly (the OP integral remains unevaluated,
though).
I don't currently have the time to test this to make sure it isn't really a
performance regression, but if someone else wants to, and you find that it
isn't, please make a pull request.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.