ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 12 Mar 2016 01:32:01 -0600Observation regarding integration with different algorithmshttp://ask.sagemath.org/question/32778/observation-regarding-integration-with-different-algorithms/I was going through some basic tutorials and noticed this interesting behavior.
integrate(exp(x)*sin(x) + exp(x)*cos(x), x)
with algorithm='maxima' gives
1/2*(cos(x) + sin(x))*e^x - 1/2*(cos(x) - sin(x))*e^x
rather than the simplified
e^x*sin(x)
given by algorithm='sympy'. It is the same when I use maxima or sympy by itself. Why is that? Why is maxima not simplifying the expression?Fri, 11 Mar 2016 05:13:50 -0600http://ask.sagemath.org/question/32778/observation-regarding-integration-with-different-algorithms/Answer by tmonteil for <p>I was going through some basic tutorials and noticed this interesting behavior.</p>
<pre><code>integrate(exp(x)*sin(x) + exp(x)*cos(x), x)
</code></pre>
<p>with algorithm='maxima' gives</p>
<pre><code>1/2*(cos(x) + sin(x))*e^x - 1/2*(cos(x) - sin(x))*e^x
</code></pre>
<p>rather than the simplified</p>
<pre><code>e^x*sin(x)
</code></pre>
<p>given by algorithm='sympy'. It is the same when I use maxima or sympy by itself. Why is that? Why is maxima not simplifying the expression?</p>
http://ask.sagemath.org/question/32778/observation-regarding-integration-with-different-algorithms/?answer=32779#post-id-32779The simplification is not automatic, you can ask explicitely for it with the `.full_simplify()` method:
sage: e = integrate(exp(x)*sin(x) + exp(x)*cos(x), x)
sage: e
1/2*(cos(x) + sin(x))*e^x - 1/2*(cos(x) - sin(x))*e^x
sage: e.full_simplify()
e^x*sin(x)
Fri, 11 Mar 2016 15:43:35 -0600http://ask.sagemath.org/question/32778/observation-regarding-integration-with-different-algorithms/?answer=32779#post-id-32779Comment by saad for <p>The simplification is not automatic, you can ask explicitely for it with the <code>.full_simplify()</code> method:</p>
<pre><code>sage: e = integrate(exp(x)*sin(x) + exp(x)*cos(x), x)
sage: e
1/2*(cos(x) + sin(x))*e^x - 1/2*(cos(x) - sin(x))*e^x
sage: e.full_simplify()
e^x*sin(x)
</code></pre>
http://ask.sagemath.org/question/32778/observation-regarding-integration-with-different-algorithms/?comment=32780#post-id-32780Thanks! This is what I needed.Sat, 12 Mar 2016 01:32:01 -0600http://ask.sagemath.org/question/32778/observation-regarding-integration-with-different-algorithms/?comment=32780#post-id-32780