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.Sat, 12 Mar 2016 08:32:01 +0100Observation regarding integration with different algorithmshttps://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 12:13:50 +0100https://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>
https://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 22:43:35 +0100https://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>
https://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 08:32:01 +0100https://ask.sagemath.org/question/32778/observation-regarding-integration-with-different-algorithms/?comment=32780#post-id-32780