On 1/13/08, Peter <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> with lprint() on, I calculated
>
> diff(1/x-1/ln(x))
>
> followed by
>
> factor(_)
>
> and the displayed answer is incorrect because prefix negation is not
> handled correctly in the _latex_ method.

Many many thanks for reporting this and finding how to fix it.
I've made this:
    http://trac.sagemath.org/sage_trac/ticket/1771

>
> The same error in a simpler setting can be observed with:
>
> (-(x-1)/2)._latex_(simplify=False)
>
> output:
>
> '\\frac{-x - 1}{2}'
>
> (The error is usually masked by the fact that symbolic expressions are
> normalized to avoid prefix negation.)
>
> I think the last two lines of the _latex_ method should probably
> change from
>
>         elif op is operator.neg:
>             return '-%s' % s[0]
>
> to something like:
>
>         elif op is operator.neg:
>             if ops[0]._has_op(operator.add) or
> ops[0]._has_op(operator.sub):
>                 s[0] = r'\left( %s \right)' %s[0]
>             return '-%s' % s[0]
>
> Sorry, I haven't figured out how to turn this into a hg patch (if the
> solution is even appropriate).
>
> --Peter
>
> >
>


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

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to