[sage-support] Re: Putting parentheses around -1.

2008-01-25 Thread John Cremona
On 25/01/2008, Paul Zimmermann [EMAIL PROTECTED] wrote: In previous versions of Mathematica, there was a RealOnly package which defined odd roots as negative and printed Nonreal anytime a complex number was unavoidable. The idea was that you could simplify things for high school

[sage-support] Re: Putting parentheses around -1.

2008-01-24 Thread kcrisman
Thus you have constructed a nice expression for 1: sage: sol[2].subs(a=1).right() (2/(3*sqrt(3)) + 10/27)^(1/3) - 2/(9*(2/(3*sqrt(3)) + 10/27)^(1/3)) + 1/3 Quiz: how to simplify that expression to 1 within SAGE? I've tried simplify, and radical_simplify, but neither succeeds... Paul

[sage-support] Re: Putting parentheses around -1.

2008-01-24 Thread William Stein
On Jan 24, 2008 10:03 AM, Carl Witty [EMAIL PROTECTED] wrote: On Jan 23, 11:41 pm, Paul Zimmermann [EMAIL PROTECTED] wrote: Thus you have constructed a nice expression for 1: sage: sol[2].subs(a=1).right() (2/(3*sqrt(3)) + 10/27)^(1/3) - 2/(9*(2/(3*sqrt(3)) + 10/27)^(1/3)) + 1/3

[sage-support] Re: Putting parentheses around -1.

2008-01-23 Thread Mike Hansen
It is due to the fact that ^ has a higher precedence than - in Python. n(-1^(1/3)) is the same as n((-1^(1/3))). --Mike On Jan 23, 2008 5:04 PM, Ted Kosan [EMAIL PROTECTED] wrote: Does anyone have any thoughts on why the following 2 code samples give different results?: #SAGE Version 2.10,

[sage-support] Re: Putting parentheses around -1.

2008-01-23 Thread Ted Kosan
Mike wrote: It is due to the fact that ^ has a higher precedence than - in Python. n(-1^(1/3)) is the same as n((-1^(1/3))). Okay, here is how I ran into this: https://sage.ssu.portsmouth.oh.us:9000/home/pub/21/ What I expected to get was -1.44224957030741. Which result should it

[sage-support] Re: Putting parentheses around -1.

2008-01-23 Thread kcrisman
On Jan 23, 8:26 pm, Ted Kosan [EMAIL PROTECTED] wrote: Mike wrote: It is due to the fact that ^ has a higher precedence than - in Python. n(-1^(1/3)) is the same as n((-1^(1/3))). Okay, here is how I ran into this: https://sage.ssu.portsmouth.oh.us:9000/home/pub/21/ What I

[sage-support] Re: Putting parentheses around -1.

2008-01-23 Thread William Stein
On Jan 23, 2008 5:50 PM, kcrisman [EMAIL PROTECTED] wrote: On Jan 23, 8:26 pm, Ted Kosan [EMAIL PROTECTED] wrote: Mike wrote: It is due to the fact that ^ has a higher precedence than - in Python. n(-1^(1/3)) is the same as n((-1^(1/3))). Okay, here is how I ran into this:

[sage-support] Re: Putting parentheses around -1.

2008-01-23 Thread Ted Kosan
kcrisman wrote: But what Ted really wanted was just the real cube root of -1. What I wanted was where the graph crossed the x axis as shown in the plot :-) Ted --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To

[sage-support] Re: Putting parentheses around -1.

2008-01-23 Thread Ted Kosan
William wrote: Until a month ago (-1)^(1/3) would have given -1. This is the default behavior dictated by Maxima. Then Paul Zimmerman complained (with a great argument) that this was stupid, and Mike Hansen changed the default Maxima behavior to what we currently have. He did this by

[sage-support] Re: Putting parentheses around -1.

2008-01-23 Thread Ted Kosan
So why is solve placing parentheses around the 3rd root it returns if it evaluates into an imaginary value? [...,..,x == (-1)^(1/3)*3^(1/3)] around the 3rd root should be around the -1 in the 3rd root Ted --~--~-~--~~~---~--~~ To post to this group, send

[sage-support] Re: Putting parentheses around -1.

2008-01-23 Thread Paul Zimmermann
[...,..,x == (-1)^(1/3)*3^(1/3)] I ran into this issue while demonstrating the usefulness of the solve function in front of a class of students. That was quite 'fun' :-) Ted It does seem strange that the answer that looked like it should be real is actually not. If you have