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.Thu, 21 Nov 2019 20:36:30 +0100Do newer versions change the way 'simplify' works?https://ask.sagemath.org/question/48815/do-newer-versions-change-the-way-simplify-works/Several years ago I did some symbolic algebra manipulations that ended up being very helpful. I did this on an Ubuntu machine (ubuntu 16) running Sage 7.4
Recently I installed the newest version of Sage 8.9, and reran some of my older notebooks. The 'simplify' function no longer produces the same output, and makes the rest of my calculations fail.
Is there something I am missing? Or has the algorithm changed?
simplify_full() on this equation:
(Z*a + Z*w2 - a + w2)*(Z*a + Z*w3 - a + w3)*y == (Z*a + Z*w1 - a + w1)*G*(Z + 1)*x
used to produce the following output:
(a^2 + a*w2 + (a+w2) *w3)*Z*2*y − 2*(a^2 − w2*w3)*Z*y + (a^2 − a*w2 − (a − w2)*w3)*y == G*Z^2*(a + w1)*x + 2*G*Z*w1*x − G*(a − w1)*x
It now produces this output:
((Z^2 - 2*Z + 1)*a^2 + (Z^2 - 1)*a*w2 + ((Z^2 - 1)*a + (Z^2 + 2*Z + 1)*w2)*w3)*y == ((G*Z^2 - G)*a + (G*Z^2 + 2*G*Z + G)*w1)*x
Is there anything I can do to force the original output using Sage 8.9 and a Jupyter Notebook?Wed, 20 Nov 2019 00:54:24 +0100https://ask.sagemath.org/question/48815/do-newer-versions-change-the-way-simplify-works/Answer by rburing for <p>Several years ago I did some symbolic algebra manipulations that ended up being very helpful. I did this on an Ubuntu machine (ubuntu 16) running Sage 7.4</p>
<p>Recently I installed the newest version of Sage 8.9, and reran some of my older notebooks. The 'simplify' function no longer produces the same output, and makes the rest of my calculations fail. </p>
<p>Is there something I am missing? Or has the algorithm changed?</p>
<p>simplify_full() on this equation:</p>
<pre><code>(Z*a + Z*w2 - a + w2)*(Z*a + Z*w3 - a + w3)*y == (Z*a + Z*w1 - a + w1)*G*(Z + 1)*x
</code></pre>
<p>used to produce the following output:</p>
<pre><code>(a^2 + a*w2 + (a+w2) *w3)*Z*2*y − 2*(a^2 − w2*w3)*Z*y + (a^2 − a*w2 − (a − w2)*w3)*y == G*Z^2*(a + w1)*x + 2*G*Z*w1*x − G*(a − w1)*x
</code></pre>
<p>It now produces this output:</p>
<pre><code>((Z^2 - 2*Z + 1)*a^2 + (Z^2 - 1)*a*w2 + ((Z^2 - 1)*a + (Z^2 + 2*Z + 1)*w2)*w3)*y == ((G*Z^2 - G)*a + (G*Z^2 + 2*G*Z + G)*w1)*x
</code></pre>
<p>Is there anything I can do to force the original output using Sage 8.9 and a Jupyter Notebook?</p>
https://ask.sagemath.org/question/48815/do-newer-versions-change-the-way-simplify-works/?answer=48817#post-id-48817When you make a vague request (e.g. 'simplify'), there is a risk that the answer will change if you ask it again.
Unfortunately I don't know what has changed or why. Maybe e.g. using `git blame` someone can find it out.
I am guessing that you are interested in the expression as a polynomial in $x,y,Z$.
A precise way to request the expression in that form is as follows (using polynomial rings):
sage: var('Z,x,y,a,w1,w2,w3,G')
sage: eqn = (Z*a + Z*w2 - a + w2)*(Z*a + Z*w3 - a + w3)*y == (Z*a + Z*w1 - a + w1)*G*(Z + 1)*x
sage: A = PolynomialRing(QQ, names='a,w1,w2,w3,G')
sage: B = PolynomialRing(A, names='Z,x,y')
sage: SR(B(eqn.lhs())) == SR(B(eqn.rhs()))
(a^2 + a*w2 + a*w3 + w2*w3)*Z^2*y - 2*(a^2 - w2*w3)*Z*y + (a^2 - a*w2 - a*w3 + w2*w3)*y == (G*a + G*w1)*Z^2*x + 2*G*Z*w1*x - (G*a - G*w1)*x
You could also factor each coefficient:
sage: sum(SR(C).factor()*SR(X) for C,X in B(eqn.lhs())) == sum(SR(C).factor()*SR(X) for C,X in B(eqn.rhs()))
Z^2*(a + w2)*(a + w3)*y - 2*(a^2 - w2*w3)*Z*y + (a - w2)*(a - w3)*y == G*Z^2*(a + w1)*x + 2*G*Z*w1*x - G*(a - w1)*xWed, 20 Nov 2019 14:28:10 +0100https://ask.sagemath.org/question/48815/do-newer-versions-change-the-way-simplify-works/?answer=48817#post-id-48817Comment by shopdog for <p>When you make a vague request (e.g. 'simplify'), there is a risk that the answer will change if you ask it again.</p>
<p>Unfortunately I don't know what has changed or why. Maybe e.g. using <code>git blame</code> someone can find it out.</p>
<p>I am guessing that you are interested in the expression as a polynomial in $x,y,Z$.</p>
<p>A precise way to request the expression in that form is as follows (using polynomial rings):</p>
<pre><code>sage: var('Z,x,y,a,w1,w2,w3,G')
sage: eqn = (Z*a + Z*w2 - a + w2)*(Z*a + Z*w3 - a + w3)*y == (Z*a + Z*w1 - a + w1)*G*(Z + 1)*x
sage: A = PolynomialRing(QQ, names='a,w1,w2,w3,G')
sage: B = PolynomialRing(A, names='Z,x,y')
sage: SR(B(eqn.lhs())) == SR(B(eqn.rhs()))
(a^2 + a*w2 + a*w3 + w2*w3)*Z^2*y - 2*(a^2 - w2*w3)*Z*y + (a^2 - a*w2 - a*w3 + w2*w3)*y == (G*a + G*w1)*Z^2*x + 2*G*Z*w1*x - (G*a - G*w1)*x
</code></pre>
<p>You could also factor each coefficient:</p>
<pre><code>sage: sum(SR(C).factor()*SR(X) for C,X in B(eqn.lhs())) == sum(SR(C).factor()*SR(X) for C,X in B(eqn.rhs()))
Z^2*(a + w2)*(a + w3)*y - 2*(a^2 - w2*w3)*Z*y + (a - w2)*(a - w3)*y == G*Z^2*(a + w1)*x + 2*G*Z*w1*x - G*(a - w1)*x
</code></pre>
https://ask.sagemath.org/question/48815/do-newer-versions-change-the-way-simplify-works/?comment=48844#post-id-48844Thanks. This was just what I needed.Thu, 21 Nov 2019 20:36:30 +0100https://ask.sagemath.org/question/48815/do-newer-versions-change-the-way-simplify-works/?comment=48844#post-id-48844