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.Fri, 08 Aug 2014 21:13:07 -0500Stange behavior in my scmd file.http://ask.sagemath.org/question/23721/stange-behavior-in-my-scmd-file/I cannot figure this out! The diff command is working fine, by why are the following two commands not working as expected?
sage: diff(sin(x^2),x)
2*x*cos(x^2)
sage: factor(8+27*x^3)
x^3
sage: latex(factor(8+27*x^3))
x^{3}Fri, 08 Aug 2014 13:04:42 -0500http://ask.sagemath.org/question/23721/stange-behavior-in-my-scmd-file/Comment by FrédéricC for <p>I cannot figure this out! The diff command is working fine, by why are the following two commands not working as expected?</p>
<pre><code> sage: diff(sin(x^2),x)
2*x*cos(x^2)
sage: factor(8+27*x^3)
x^3
sage: latex(factor(8+27*x^3))
x^{3}
</code></pre>
http://ask.sagemath.org/question/23721/stange-behavior-in-my-scmd-file/?comment=23722#post-id-23722Hello, which version of sage are you using ? Did you type something before these lines ?Fri, 08 Aug 2014 14:17:14 -0500http://ask.sagemath.org/question/23721/stange-behavior-in-my-scmd-file/?comment=23722#post-id-23722Answer by slelievre for <p>I cannot figure this out! The diff command is working fine, by why are the following two commands not working as expected?</p>
<pre><code> sage: diff(sin(x^2),x)
2*x*cos(x^2)
sage: factor(8+27*x^3)
x^3
sage: latex(factor(8+27*x^3))
x^{3}
</code></pre>
http://ask.sagemath.org/question/23721/stange-behavior-in-my-scmd-file/?answer=23726#post-id-23726It seems you are computing in polynomials over the finite field with two elements.
In a fresh Sage session, `factor(8+27*x^3)` outputs `(9*x^2 - 6*x + 4)*(3*x + 2)`.
But if you compute in polynomials over `GF(2)`, you would just get `x^3`.
sage: R = PolynomialRing(GF(2),'x')
sage: x = R.gen()
sage: factor(8+27*x^3)
x^3
Fri, 08 Aug 2014 19:10:07 -0500http://ask.sagemath.org/question/23721/stange-behavior-in-my-scmd-file/?answer=23726#post-id-23726Comment by ron.bannon for <p>It seems you are computing in polynomials over the finite field with two elements.</p>
<p>In a fresh Sage session, <code>factor(8+27*x^3)</code> outputs <code>(9*x^2 - 6*x + 4)*(3*x + 2)</code>.</p>
<p>But if you compute in polynomials over <code>GF(2)</code>, you would just get <code>x^3</code>.</p>
<pre><code>sage: R = PolynomialRing(GF(2),'x')
sage: x = R.gen()
sage: factor(8+27*x^3)
x^3
</code></pre>
http://ask.sagemath.org/question/23721/stange-behavior-in-my-scmd-file/?comment=23727#post-id-23727Okay, I just inserted a reset() command before this call and it's now working. THANKS!Fri, 08 Aug 2014 21:13:07 -0500http://ask.sagemath.org/question/23721/stange-behavior-in-my-scmd-file/?comment=23727#post-id-23727