#12780: Be more careful about setting the Maxima 'domain'
------------------------------------+---------------------------------------
Reporter: mjo | Owner: burcin
Type: enhancement | Status: closed
Priority: major | Milestone: sage-5.6
Component: symbolics | Resolution: fixed
Keywords: | Work issues:
Report Upstream: N/A | Reviewers: Burcin Erocal
Authors: Michael Orlitzky | Merged in: sage-5.6.beta0
Dependencies: #12845 | Stopgaps:
------------------------------------+---------------------------------------
Comment (by mjo):
Replying to [comment:20 zimmerma]:
>
> Note: I didn't call {{{radcan}}}, but {{{simplify_radical}}}...
[[BR]]
The only thing that `simplify_radical()` does is call Maxima's `radcan()`,
and `radcan` doesn't do simplification. Instead, it (usually) mangles your
expression. That's why I'm so vocally opposed to it being called
"simplify."
I agree 100% that the current answer is wrong.. nothing with "simplify" in
the name should convert `sqrt(x^2)` to `x`. But the previous behavior was
also wrong. You can leave off the assumption that `x` is real, and this
will still happen:
{{{
sage: sqrt(x^2).simplify_radical()
abs(x)
}}}
It's less wrong, maybe. But still wrong. In fact, the underlying call to
`radcan()` wasn't doing anything here. The "simplification" is actually
due to the silent switch to the reals. To see this, you can set the Maxima
domain, and send your expression for a round trip through Maxima and back.
This is in a current version of sage:
{{{
sage: maxima_lib.eval('domain: real;')
'real'
sage: maxima_lib(sqrt(x^2))
abs(x)
}}}
Now that we've fixed ''that'' bug (in this ticket), the expression
`sqrt(x^2)` is passed verbatim to `radcan()`. ''Now'', it has something to
mangle. And it does. It gives you `x` back. So ultimately, the previous,
more-correct behavior was the result of a lesser bug preventing `radcan()`
from doing more damage.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12780#comment:21>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.