[sage-support] Re: confusing output? latex(7-(-1)^(1/3))

2009-01-18 Thread William Stein

On Sun, Jan 18, 2009 at 10:07 AM, Robert Dodier  wrote:
>
> William Stein wrote:
>
>> sage: a = 7-(-1)^(1/3)
>> sage: latex(a._maxima_())
>> 7-\left(-1\right)^{{{1}\over{3}}}
>>
>> Don't use maxima(a), since then you'll get a in a session of maxima
>> that has different defaults than the calculus module uses, in



>> particular, roots are always assumed real, which may be bad (though
>> maybe ok for economists):
>>
>> sage: a = 7-(-1)^(1/3)
>> sage: latex(maxima(a))
>> 8
>
> FWIW in Maxima domain:complex prevents simplification of (-1)^(1/3).

Thanks for mentioning this.  The "different defaults" I was mentioning above
include setting domain:complex in the Maxima used for Sage calculus, since
Paul Zimmerman convinced us we should.

William

>
> domain : complex;
> 7 - (- 1)^(1/3);
>  => 7-(-1)^(1/3)
> tex (%);
>  => $$7-\left(-1\right)^{{{1}\over{3}}}$$
>
> Without reading the code I don't know the full extent of the wonders
> wrought by domain:complex.
>
> Robert Dodier
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: confusing output? latex(7-(-1)^(1/3))

2009-01-18 Thread Robert Dodier

William Stein wrote:

> sage: a = 7-(-1)^(1/3)
> sage: latex(a._maxima_())
> 7-\left(-1\right)^{{{1}\over{3}}}
>
> Don't use maxima(a), since then you'll get a in a session of maxima
> that has different defaults than the calculus module uses, in
> particular, roots are always assumed real, which may be bad (though
> maybe ok for economists):
>
> sage: a = 7-(-1)^(1/3)
> sage: latex(maxima(a))
> 8

FWIW in Maxima domain:complex prevents simplification of (-1)^(1/3).

domain : complex;
7 - (- 1)^(1/3);
 => 7-(-1)^(1/3)
tex (%);
 => $$7-\left(-1\right)^{{{1}\over{3}}}$$

Without reading the code I don't know the full extent of the wonders
wrought by domain:complex.

Robert Dodier

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: confusing output? latex(7-(-1)^(1/3))

2009-01-17 Thread Robert Bradshaw

On Jan 17, 2009, at 4:00 PM, William Stein wrote:

> On Sat, Jan 17, 2009 at 3:01 PM, Jason Grout
>  wrote:
>>
>> William Stein wrote:
>>>
>>> This bug that you reported is now
>>>
>>>http://trac.sagemath.org/sage_trac/ticket/5004
>>>
>>
>>
>> This bug came up a while ago on the mailing list and already had a  
>> trac
>> ticket:
>>
>> http://trac.sagemath.org/sage_trac/ticket/4548
>>
>> I guess it's a dup now, since 5004 has the patch.
>
> Thanks, i closed 4548 as a dup.It's kind of sad, since *I* opened
> both #4548 and #5004.

This reminds me of something that's bothered me for a while--does  
anyone know how to a search for only *open* tickets?

- Robert



--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: confusing output? latex(7-(-1)^(1/3))

2009-01-17 Thread William Stein

On Sat, Jan 17, 2009 at 3:01 PM, Jason Grout
 wrote:
>
> William Stein wrote:
>>
>> This bug that you reported is now
>>
>>http://trac.sagemath.org/sage_trac/ticket/5004
>>
>
>
> This bug came up a while ago on the mailing list and already had a trac
> ticket:
>
> http://trac.sagemath.org/sage_trac/ticket/4548
>
> I guess it's a dup now, since 5004 has the patch.

Thanks, i closed 4548 as a dup.It's kind of sad, since *I* opened
both #4548 and #5004.

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: confusing output? latex(7-(-1)^(1/3))

2009-01-17 Thread Jason Grout

William Stein wrote:
> 
> This bug that you reported is now
> 
>http://trac.sagemath.org/sage_trac/ticket/5004
> 


This bug came up a while ago on the mailing list and already had a trac 
ticket:

http://trac.sagemath.org/sage_trac/ticket/4548

I guess it's a dup now, since 5004 has the patch.

Jason


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: confusing output? latex(7-(-1)^(1/3))

2009-01-17 Thread William Stein

On Sat, Jan 17, 2009 at 1:57 PM, Mike Hansen  wrote:
>
> Hello,
>
> On Sat, Jan 17, 2009 at 1:25 PM, William Stein  wrote:
>> This bug that you reported is now
>>
>>   http://trac.sagemath.org/sage_trac/ticket/5004
>
> I've posted a patch there which should take care of the issue.
>
> --Mike

Nice, and I gave it a positive review.

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: confusing output? latex(7-(-1)^(1/3))

2009-01-17 Thread Mike Hansen

Hello,

On Sat, Jan 17, 2009 at 1:25 PM, William Stein  wrote:
> This bug that you reported is now
>
>   http://trac.sagemath.org/sage_trac/ticket/5004

I've posted a patch there which should take care of the issue.

--Mike

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: confusing output? latex(7-(-1)^(1/3))

2009-01-17 Thread William Stein

On Sat, Jan 17, 2009 at 8:22 AM, ma...@mendelu.cz  wrote:
>
> Hello all
>
> The command latex(7-(-1)^(1/3))   produces 7 - {-1}^{\frac{1}{3}}
> Is it possible to change it into 7 - \left(-1\right)^{\frac{1}{3}}
>
> Which function should be redefined to gain this behavior?
>
> I think that two minus sign, one following the other, could be
> confusing (for students of economics, for example :) )
>
> Thank you
> Robert

I would start by doing:

sage: a = (-1)^(1/3)
sage: a._latex_??
[... source code in calculus.py...]

Then I would look at the code, and be confused for about an hour,
finally probably figure out what is going on, and maybe with luck be
able to fix this.
IIRC the code to get the latex for symbolic expressions is
complicated.  I think it was written by Bobby Moretti (and undergrad
who used to be a sage developer).

I think this sort of behavior, e.g.,

sage: a = (-1)^(1/4)
sage: latex(a)
{-1}^{\frac{1}{4}}

should officially be considered a bug in fact.  It's not just
confusing, it's wrong.

By the way, one trick you can use is to convert the expression to
maxima first and use its latex.  For some things, e.g., your example
above, this works better:

sage: a = 7-(-1)^(1/3)
sage: latex(a._maxima_())
7-\left(-1\right)^{{{1}\over{3}}}

Don't use maxima(a), since then you'll get a in a session of maxima
that has different defaults than the calculus module uses, in
particular, roots are always assumed real, which may be bad (though
maybe ok for economists):

sage: a = 7-(-1)^(1/3)
sage: latex(maxima(a))
8

This bug that you reported is now

   http://trac.sagemath.org/sage_trac/ticket/5004

 -- William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---