Ask Your Question

Round trip through Mathematica's FullSimplify

asked 2011-01-06 16:54:26 -0500

dstahlke gravatar image

The following command returns 1:

mathematica(-2/(1 + sqrt(3)*I)).FullSimplify().sage()

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?

edit retag flag offensive close merge delete


By (-1)/(2/3) I think you mean (-1)^(2/3)?

Felix Lawrence gravatar imageFelix Lawrence ( 2011-01-06 18:48:14 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2011-01-06 18:47:37 -0500

Felix Lawrence gravatar image

Conversion back from mathematica is a little dodgy at the moment. I would recommend applying the patch at #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)
edit flag offensive delete link more

answered 2011-01-07 17:06:23 -0500

kcrisman gravatar image

I think this is because this is an even power.

sage: (-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);
(%o2)                              (- 1)
(%i3) (-1)^(2/3);
(%o3)                              (- 1)

I wonder what Mma and Maple do for this.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-01-06 16:54:26 -0500

Seen: 726 times

Last updated: Jan 07 '11