Hi Eric,
Thanks for sharing the `simplify_real`!
However, I am not happy with this solution either. The method
simplify_real never checks the domain of functions. This is a complete
nonsense.
sage: (sqrt(-x) * sqrt(-x)).simplify_real()
-x
I would like simplify to do the following
- if there is a product of `sqrt` in the tree
- determine whether the argument inside are `>= 0`
- if this is true then replace `sqrt(x_1) sqrt(x_2) ... sqrt(x_n)` by
`sqrt(x_1 x_2 ... x_n)`
For example, I would the following to be automatic
sage: x = SR.var('x')
sage: y = SR.var('y')
sage: assume(x, 'real')
sage: assumE(y, 'real')
sage: p = sqrt(x^2 + 1) * sqrt(y^2 + 1)
sage: p.simplify() # or maybe expand?
sqrt(x^2*y^2 + x^2 + y^2 + 1)
An equality involving only sum/prod/rational powers can be decided (at
least if the domain of a variable is determined by linear conditions).
Best,
Vincent