Fix for bug [ 1370433 ] trigsimp(sqrt(%i2)) !=sqrt(trigsimp(%i2))?



On Thu, 2006-11-09, Raymond Toy wrote:
> expr:2*(cos(x)^2-sin(x)^2)+2;
> sqrt(trigsimp(expr))
> trigsimp(sqrt(expr))

> Richard Fateman wrote:
> > There are two square roots. Which do you mean?
> > either 2*abs(cos(x))  or -2*abs(cos(x))
> > Since you have not specified which one, how is Maxima to know?
> >   
> Doesn't sqrt(x) mean the principal square root?
That was what I thought too. When Maxima gives me the results:

(%i2) sqrt(x^2);
(%o2) abs(x)
(%i3) solve(a*x^2+b*x+c, x);
(%o3) [x = -(sqrt(b^2-4*a*c)+b)/(2*a),x = (sqrt(b^2-4*a*c)-b)/(2*a)]

I understand that sqrt() refers to the square root with either real or
imaginary part positive. Otherwise, if sqrt() referred to the two roots,
the results above should be:
(%o2) [abs(x), -abs(x)]
(%o3) x = (sqrt(b^2-4*a*c)+b)/(2*a)

( or x = -(sqrt(b^2-4*a*c)+b)/(2*a) which would be equivalent)

Thus, I would expect both sqrt(trigsimp(expr)) and trigsimp(sqrt(expr))
to return 2*abs(cos(x))

On the same subject, following a question recently answered in this
list, I would expect plot2d(sqrt(x^2),[x,-3,3]) to show the plot of
abs(x)

Jaime