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



>>>>> "Raymond" == Raymond Toy <raymond.toy at ericsson.com> writes:

>>>>> "Richard" == Richard Fateman <fateman at cs.berkeley.edu> writes:
    Richard> Simplification functions are supposed to change the form of an
    Richard> expression, but not its value. For example,
    Richard> x+x -->  2*x

    Richard> radcan is supposed to be a simplification function.  But it apparently
    Richard> changes the value of sqrt( y^2-2*x*y-x^2).

    Richard> So something is wrong.
    Richard> Maybe radcan, maybe sqrt, maybe both.

    Raymond> I'm inclined to say radcan, since it's documented to do "unexpected"
    Raymond> things:

    Raymond>      When `radexpand' is `false', certain transformations are inhibited.
    Raymond>      `radcan (sqrt (1-x))' remains `sqrt (1-x)' and is not simplified
    Raymond>      to `%i sqrt (x-1)'.  `radcan (sqrt (x^2 - 2*x + 11))' remains
    Raymond>      `sqrt (x^2 - 2*x + 1)' and is not simplified to `x - 1'.

    Raymond> radexpand defaults to true.  I normally wouldn't want sqrt(x^2-2*x+1)
    Raymond> to become x-1, unless I know x >= 1.  I'm willing to accept abs(x-1),
    Raymond> however. 

    Richard> Is this a trigsimp bug, as indicated by the subject line?  I claim it
    Richard> is something deeper.

    Raymond> Yes, you are right.  It's not really a trigsimp problem, other than
    Raymond> trigsimp calls radcan.  The issue is really with radcan, and what it
    Raymond> is supposed to do.  My proposed fix was basically to replace radcan
    Raymond> with ratsimp, which really just hides the problem.

After some more discussions with Richard, we decided that it's
probably ok to replace radcan with ratsimp in this situation.

The underlying issue is still there, but we're not going to fix that
any time soon since it's unclear what radcan really should do.

I'll check in this fix soon.

Ray