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, 04 Jul 2011 21:17:55 +0200How to get more uniform output from full_simplifyhttps://ask.sagemath.org/question/8169/how-to-get-more-uniform-output-from-full_simplify/I do this,
sage: var('x1,t1,x2,t2,u,c',domain=RR);assume(u>0);assume(c>0);assume(c>u);
(x1, t1, x2, t2, u, c)
sage: T1 = (t1-((u*x1)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: T2 = (t2-((u*x2)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: dT = T2-T1
sage: view(dT.full_simplify())
And I get,
$\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{\sqrt{c - u} \sqrt{c + u} {\left(c^{2} t_{1} - c^{2} t_{2} - u x_{1} + u x_{2}\right)}}{c^{3} - c u^{2}}$
I put this expression in which is supposed to be the same,
sage: s = ((t2-t1)-((u/(c^2))*(x2-x1)))/sqrt(1-((u^2)/(c^2)))
sage: view(s.full_simplify())
And get this,
$\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{c^{2} t_{1} - c^{2} t_{2} - u x_{1} + u x_{2}}{\sqrt{c - u} \sqrt{c + u} c}$
It is not immediately apparent to me that dT and s are the same. But they are both equal as can be seen by,
sage: (s-dT).full_simplify()
0
This is something minor, but is there something I can do to get a simplified expression which is more uniform every time I use full_simplify()?
Thanks.Sat, 18 Jun 2011 18:24:03 +0200https://ask.sagemath.org/question/8169/how-to-get-more-uniform-output-from-full_simplify/Comment by parzan for <p>I do this,</p>
<pre><code>sage: var('x1,t1,x2,t2,u,c',domain=RR);assume(u>0);assume(c>0);assume(c>u);
(x1, t1, x2, t2, u, c)
sage: T1 = (t1-((u*x1)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: T2 = (t2-((u*x2)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: dT = T2-T1
sage: view(dT.full_simplify())
</code></pre>
<p>And I get,</p>
<p>$\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{\sqrt{c - u} \sqrt{c + u} {\left(c^{2} t_{1} - c^{2} t_{2} - u x_{1} + u x_{2}\right)}}{c^{3} - c u^{2}}$</p>
<p>I put this expression in which is supposed to be the same,</p>
<pre><code>sage: s = ((t2-t1)-((u/(c^2))*(x2-x1)))/sqrt(1-((u^2)/(c^2)))
sage: view(s.full_simplify())
</code></pre>
<p>And get this,</p>
<p>$\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{c^{2} t_{1} - c^{2} t_{2} - u x_{1} + u x_{2}}{\sqrt{c - u} \sqrt{c + u} c}$</p>
<p>It is not immediately apparent to me that dT and s are the same. But they are both equal as can be seen by,</p>
<pre><code>sage: (s-dT).full_simplify()
0
</code></pre>
<p>This is something minor, but is there something I can do to get a simplified expression which is more uniform every time I use full_simplify()?</p>
<p>Thanks.</p>
https://ask.sagemath.org/question/8169/how-to-get-more-uniform-output-from-full_simplify/?comment=21573#post-id-21573I don't know it this provides any comfort, but in maple and mathematica as well "simplify" does not give the same output for equivalent inputs, and simplify(A-B) is usually needed to see whether two expressions are equivalent. It might be argued that choosing a canonic representative to every class of equivalent symbolic expressions is far from being a trivial problem...Sun, 19 Jun 2011 09:27:17 +0200https://ask.sagemath.org/question/8169/how-to-get-more-uniform-output-from-full_simplify/?comment=21573#post-id-21573Comment by omoplata for <p>I do this,</p>
<pre><code>sage: var('x1,t1,x2,t2,u,c',domain=RR);assume(u>0);assume(c>0);assume(c>u);
(x1, t1, x2, t2, u, c)
sage: T1 = (t1-((u*x1)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: T2 = (t2-((u*x2)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: dT = T2-T1
sage: view(dT.full_simplify())
</code></pre>
<p>And I get,</p>
<p>$\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{\sqrt{c - u} \sqrt{c + u} {\left(c^{2} t_{1} - c^{2} t_{2} - u x_{1} + u x_{2}\right)}}{c^{3} - c u^{2}}$</p>
<p>I put this expression in which is supposed to be the same,</p>
<pre><code>sage: s = ((t2-t1)-((u/(c^2))*(x2-x1)))/sqrt(1-((u^2)/(c^2)))
sage: view(s.full_simplify())
</code></pre>
<p>And get this,</p>
<p>$\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{c^{2} t_{1} - c^{2} t_{2} - u x_{1} + u x_{2}}{\sqrt{c - u} \sqrt{c + u} c}$</p>
<p>It is not immediately apparent to me that dT and s are the same. But they are both equal as can be seen by,</p>
<pre><code>sage: (s-dT).full_simplify()
0
</code></pre>
<p>This is something minor, but is there something I can do to get a simplified expression which is more uniform every time I use full_simplify()?</p>
<p>Thanks.</p>
https://ask.sagemath.org/question/8169/how-to-get-more-uniform-output-from-full_simplify/?comment=21570#post-id-21570Thanks for the comment. Yeah, practically it's not that important. But I was just wondering if it was impossible.Mon, 20 Jun 2011 03:07:44 +0200https://ask.sagemath.org/question/8169/how-to-get-more-uniform-output-from-full_simplify/?comment=21570#post-id-21570Answer by Jason Grout for <p>I do this,</p>
<pre><code>sage: var('x1,t1,x2,t2,u,c',domain=RR);assume(u>0);assume(c>0);assume(c>u);
(x1, t1, x2, t2, u, c)
sage: T1 = (t1-((u*x1)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: T2 = (t2-((u*x2)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: dT = T2-T1
sage: view(dT.full_simplify())
</code></pre>
<p>And I get,</p>
<p>$\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{\sqrt{c - u} \sqrt{c + u} {\left(c^{2} t_{1} - c^{2} t_{2} - u x_{1} + u x_{2}\right)}}{c^{3} - c u^{2}}$</p>
<p>I put this expression in which is supposed to be the same,</p>
<pre><code>sage: s = ((t2-t1)-((u/(c^2))*(x2-x1)))/sqrt(1-((u^2)/(c^2)))
sage: view(s.full_simplify())
</code></pre>
<p>And get this,</p>
<p>$\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{c^{2} t_{1} - c^{2} t_{2} - u x_{1} + u x_{2}}{\sqrt{c - u} \sqrt{c + u} c}$</p>
<p>It is not immediately apparent to me that dT and s are the same. But they are both equal as can be seen by,</p>
<pre><code>sage: (s-dT).full_simplify()
0
</code></pre>
<p>This is something minor, but is there something I can do to get a simplified expression which is more uniform every time I use full_simplify()?</p>
<p>Thanks.</p>
https://ask.sagemath.org/question/8169/how-to-get-more-uniform-output-from-full_simplify/?answer=12040#post-id-12040As mentioned in the comment, it's probably not practical to try to always give consistent output from simplify, at least automatically.Mon, 04 Jul 2011 21:17:55 +0200https://ask.sagemath.org/question/8169/how-to-get-more-uniform-output-from-full_simplify/?answer=12040#post-id-12040