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, 08 Jan 2011 00:06:23 +0100Round trip through Mathematica's FullSimplifyhttps://ask.sagemath.org/question/7845/round-trip-through-mathematicas-fullsimplify/The following command returns 1:
<code>
mathematica(-2/(1 + sqrt(3)*I)).FullSimplify().sage()
</code>
The issue is that Mathematica simplifies this expression to (-1)/(2/3), which it considers to be defined in terms of the primitive root. Sage on the other hand converts (-1)/(2/3) to 1, with the idea that any root will do. My question: is it a bug that putting this equation into Mathematica and bringing it back to Sage changes it from a complex number to a real number?
Thu, 06 Jan 2011 23:54:26 +0100https://ask.sagemath.org/question/7845/round-trip-through-mathematicas-fullsimplify/Comment by Felix Lawrence for <p>The following command returns 1:</p>
<p><code>
mathematica(-2/(1 + sqrt(3)*I)).FullSimplify().sage()
</code></p>
<p>The issue is that Mathematica simplifies this expression to (-1)/(2/3), which it considers to be defined in terms of the primitive root. Sage on the other hand converts (-1)/(2/3) to 1, with the idea that any root will do. My question: is it a bug that putting this equation into Mathematica and bringing it back to Sage changes it from a complex number to a real number?</p>
https://ask.sagemath.org/question/7845/round-trip-through-mathematicas-fullsimplify/?comment=22321#post-id-22321By (-1)/(2/3) I think you mean (-1)^(2/3)?Fri, 07 Jan 2011 01:48:14 +0100https://ask.sagemath.org/question/7845/round-trip-through-mathematicas-fullsimplify/?comment=22321#post-id-22321Answer by kcrisman for <p>The following command returns 1:</p>
<p><code>
mathematica(-2/(1 + sqrt(3)*I)).FullSimplify().sage()
</code></p>
<p>The issue is that Mathematica simplifies this expression to (-1)/(2/3), which it considers to be defined in terms of the primitive root. Sage on the other hand converts (-1)/(2/3) to 1, with the idea that any root will do. My question: is it a bug that putting this equation into Mathematica and bringing it back to Sage changes it from a complex number to a real number?</p>
https://ask.sagemath.org/question/7845/round-trip-through-mathematicas-fullsimplify/?answer=11939#post-id-11939I think this is because this is an even power.
sage: (-1)^(1/3)
(-1)^(1/3)
People complain about this all the time (including me, in the past) esp. because of plotting, though apparently this is consistent with Mma and Maple. But really it's the internal simplification in Ginac/Pynac that is doing this. Maxima, incidentally, does NOT do this.
(%i1) domain:complex;
(%o1) complex
(%i2) (-1)^(1/3);
1/3
(%o2) (- 1)
(%i3) (-1)^(2/3);
2/3
(%o3) (- 1)
I wonder what Mma and Maple do for this. Sat, 08 Jan 2011 00:06:23 +0100https://ask.sagemath.org/question/7845/round-trip-through-mathematicas-fullsimplify/?answer=11939#post-id-11939Answer by Felix Lawrence for <p>The following command returns 1:</p>
<p><code>
mathematica(-2/(1 + sqrt(3)*I)).FullSimplify().sage()
</code></p>
<p>The issue is that Mathematica simplifies this expression to (-1)/(2/3), which it considers to be defined in terms of the primitive root. Sage on the other hand converts (-1)/(2/3) to 1, with the idea that any root will do. My question: is it a bug that putting this equation into Mathematica and bringing it back to Sage changes it from a complex number to a real number?</p>
https://ask.sagemath.org/question/7845/round-trip-through-mathematicas-fullsimplify/?answer=11938#post-id-11938Conversion back from mathematica is a little dodgy at the moment. I would recommend applying the patch at [#8495](http://trac.sagemath.org/sage_trac/ticket/8495) if you want to call .sage() on different types of mathematica objects - otherwise just look at Mathematica's output directly (i.e. drop the `.sage()`) and retype the output.
However, in this case it doesn't seem to be anything to do with the conversion from Mathematica to Sage - Sage chooses this root even if you enter things directly:
sage: (-1)^(2/3)
1
Fri, 07 Jan 2011 01:47:37 +0100https://ask.sagemath.org/question/7845/round-trip-through-mathematicas-fullsimplify/?answer=11938#post-id-11938