On 11/05/2014 08:34 AM, kcrisman wrote:

> 
> Just to clarify, current behavior is
> 
> sage: a = sqrt(x^2)
> sage: a.simplify_radical()
> x

Yeah, previously, simplify_radical() was silently setting the domain to
'real', calling radcan(), and then setting the domain back to 'complex'.

The round trip through Maxima (with the domain set to 'real') made the
simplification sqrt(x^2) -> abs(x), at which point radcan() could do
nothing with it. By fixing one bug, the output actually became worse
because now radcan() sees the full sqrt(x^2) and will choose one root
"arbitrarily but consistently."


> Anyway, as to your solution, I think that after this time rws is
> probably right that since no one actually implemented a context manager
> or domain parameter or whatever else then the option on the ticket
> (which needs to be a branch, sigh) is better than nothing.  At least it
> finally allows sqrt(x^2) -> abs(x) again.  Though it should be tried
> with lots of irrelevant and perhaps strange assumptions like integer
> around to make sure it really re-assumes all assumptions when needed.

I just posted a branch with an additional test for assumptions(). It
also fixes an earlier bug (that I most likely introduced!) -- a test
earlier in the file that didn't forget() its assumptions.


>>  So you're kind of on your own regarding how many simplifications to
> try and in what order.
> 
> Yes, that is currently the case anyway.  

We could always brute-force them. Tools like pngcrush use this to find
the best compression settings. Expression.simplify_rectform() already
checks to see if the result is "simpler" (via a highly complicated
algorithm, len(str(x))), so there's no reason we couldn't try 100
simplifications and see which is "less complex."

-- 
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/d/optout.

Reply via email to