On 06/19/2013 03:03 AM, Eric Gourgoulhon wrote:
> 
> Thanks for your explanation regarding how radcan works.
> 
> If radcan ignores assumptions, how can one explain the following behavior:
> 
> sage: assume(x<0)
> sage: sqrt(x^2).simplify_radical()
> x
> sage: maxima_calculus.eval('domain:real')
> 'real'
> sage: sqrt(x^2).simplify_radical()
> -x
> 
> It seems that assuming the domain is 'real' had an effect on radcan.
> 

The code for simplify() just sends an expression to Maxima and back:

  return self._parent(self._maxima_())

If you set the domain to real, and send that expression to Maxima and
back, you get abs(x):

  sage: _ = maxima_lib.eval('domain:real')
  sage: sqrt(x^2).simplify()
  abs(x)

Now if you assume x<0, you get -x.

In simplify_radical(), we necessarily have to send the expression
through Maxima in order to call radcan() on it. As soon as the
expression hits Maxima, the above simplification happens (before radcan
can do anything).

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to