rootscontract(%i/2) -> -%i/2



We have a bug report ID: 2820202 - rootscontract(%i/2).

In the algorithm of rootscontract we have the following substitution for
some cases:

%i -> (-1)*(-1)^(-1/2)

This substitution is responsible for the bug:

(%i19) rootscontract(%i/2);
(%o19) -%i/2

We get the error for a lot of other expressions too:

(%i20) rootscontract(%i/(a+b*x));
(%o20) -%i/(b*x+a)

I think there is only one situation this works: 

(%i26) rootscontract(%i/sqrt(x));
(%o26) -1/sqrt(-x)

But it does not work for numbers. Again we get a wrong result:

(%i31) rootscontract(%i/sqrt(2));
(%o31) -%i/sqrt(2)

If we cut out the special substitution %i -> -1*(-1)^(-1/2) the errors
will vanish. The testsuite and the share-testsuite have no problems. The
only change is, that we no longer get the simplification %i/sqrt(x) ->
-1/sqrt(-x).

Furthermore, I think this simplification is in most cases not very
useful.

What do you think? Should we cut out this special case, which causes in
most cases wrong results?

Dieter Kaiser