ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 15 May 2017 10:02:19 +0200Why doesn't Sage do obvious simplifications?https://ask.sagemath.org/question/37591/why-doesnt-sage-do-obvious-simplifications/ I wanted Sage to simplify 1/2*(cos(x) + sin(x))*e^x - 1/2*(cos(x) - sin(x))*e^x , which easily comes out to e^x*sin(x), but it simply gave me the original term. Why doesn't Sage combine simple terms, or is there a way to make it do that?
Mon, 15 May 2017 03:55:47 +0200https://ask.sagemath.org/question/37591/why-doesnt-sage-do-obvious-simplifications/Answer by mforets for <pre><code> I wanted Sage to simplify 1/2*(cos(x) + sin(x))*e^x - 1/2*(cos(x) - sin(x))*e^x , which easily comes out to e^x*sin(x), but it simply gave me the original term. Why doesn't Sage combine simple terms, or is there a way to make it do that?
</code></pre>
https://ask.sagemath.org/question/37591/why-doesnt-sage-do-obvious-simplifications/?answer=37593#post-id-37593i guess that you are using `simplify(expr)`, where `expr` is your symbolic expression. but notice that TAB completion like `expr.simplify[TAB]` reveals 11 simplify flavors. several of them will produce the expected output.
for example,
sage: expr = (1/2*(cos(x) + sin(x))*e^x - 1/2*(cos(x) - sin(x))*e^x)
sage: expr.simplify_full()
e^x*sin(x)
--
the top-level simplify has the same effect as `expr.simplify()`, as you can check in the code (use double question mark then hit enter, `simplify??`).Mon, 15 May 2017 10:02:19 +0200https://ask.sagemath.org/question/37591/why-doesnt-sage-do-obvious-simplifications/?answer=37593#post-id-37593