# simplify sqrt(x/y^2)*y

Hello my problem is with a bigger equation but the problem is bassicly this : sage: var('x','y', domain=real)
sage: assume(x>0)
sage: assume(y>0)
sage: e = sqrt(1/y^2)y
sage: e.simplify_full()
1
sage: e = sqrt(x/y^2)
y
sage: e.simplify_full()
y*sqrt(x/y^2)

Anyone explain me how to get just sqrt(x) and why it doesn't do directly? Thanks

edit retag close merge delete

Sort by » oldest newest most voted

I hope there is no way to coerce Sage into returning just x, because your expression is only equal to that for a very limited number of choices for x. Sage (Maxima, really) can be convinced to make branch choices to simplify the expression to sqrt(x), but not via assumptions, apparently. This does work:

sage: var('x,y')
(x, y)
sage: E=sqrt(x/y^2)*y
sqrt(x)


See the documentation of canonicalize_radical for details.

more

Yes, I mean just "x" part so sqrt(x)... sorry for not to be clear. Thanks. It works, but I wonder why canonicalize_radical isn't part of simplify_full?

more

This is because

sage: x = var('x', domain='real')
sage: assume(x<0)
x


and I guess you don't want this (note the x<0 assumption).

I don't want this beacause is false. I want sqrt(x^2)=abs(x) or in case ofassume(x>0) or assume(x<0) : sqrt(x^2)=x or sqrt(x^2)=-x resp

I mean if I had the time and knowleage, I change it in the source code. Nevertheless, I'm thankful to all community of sagemath

A fix should be possible with pynac-0.4.x (pynac is part of Sage); pynac git master already does sqrt(x^2) --> x for x>0 as side effect of other changes.