Because it's nicer when the output looks like the input. For instance, sin and cos are easier to integrate if rewritten as tan first, but it's annoying to write integrate(sin(x)) and get -2/(tan(x/2)**2 + 1) instead of -cos(x).
For elementary functions, such as this one, the Risch algorithm should handle them no matter what they look like. To be sure, internally it might need to do all kinds of canoncalizing, but the difference is that it can do very targeted simplifications and try to put things back when it is done. It's hard to tell the generic simplify() something as simple as "ignore anything that doesn't have x" (i.e., don't try simplifying complicated symbolic constants). The other issue is that simplify() can sometimes be very slow, and it would be a shame to run it if it weren't needed. Also, note that the Risch algorithm for trig functions isn't actually implemented in SymPy yet. I'm just pointing out that when it is implemented, it will handle this better. Aaron Meurer On Wed, Oct 15, 2014 at 2:20 PM, Richard Fateman <[email protected]> wrote: > > > On Sunday, October 12, 2014 1:27:27 PM UTC-7, Aaron Meurer wrote: >> >> I don't think integrate() tries any simplification. Ideally it >> shouldn't have to. > > > Why not? It seems to me quite the opposite. That is, integration is > much easier if the input is first converted to some canonical form > (or one of a few canonical forms). > > RJF >> >> >> Aaron Meurer >> >> On Sun, Oct 12, 2014 at 6:12 AM, Francesco Bonazzi >> <[email protected]> wrote: >> > >> > >> > On Sunday, October 12, 2014 1:50:10 AM UTC+2, Aaron Meurer wrote: >> >> >> >> That's correct. If integrate() returns an unevaluated Integral, it >> >> means the algorithm couldn't compute an integral. The fu() function is >> >> able to simplify this expression (it equals 2*sin(x)), so >> >> integrate(fu(fx), x) works. >> >> >> > >> > Why is fu( ) not attempted in the integrate( ) algorithm? >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "sympy" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at http://groups.google.com/group/sympy. >> > To view this discussion on the web visit >> > >> > https://groups.google.com/d/msgid/sympy/6014ba22-a647-4e51-9905-730eadb5fd26%40googlegroups.com. >> > >> > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/b04a7673-6ea0-4f3b-82ab-fef23babde38%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6JxBMrO8fTypyj1P-Wff_qUSgX3W3HgbE1Hd0S7ntw7Pw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
