still getting a pesky question from realpart



Am Sonntag, den 31.05.2009, 23:33 +0200 schrieb Dieter Kaiser:
> Am Sonntag, den 31.05.2009, 14:54 -0600 schrieb Robert Dodier:
> > Hello,
> > 
> > realpart (asin (x + y*%i));
> >  => Is  x y  positive, negative, or zero?
> > 
> > I was hoping such questions were a thing of the past ...
> > Maybe I haven't been paying attention.
> > 
> > To what extent does realpart & friends (imagpart, carg,
> > cabs) still make use of asksign?
> 
> Hello Robert,
> 
> I will have a look at the problem. 
> 
> The time I have improved the code I have not removed asksign at all
> places, but only at one place where we get obviously a problem. I always
> try to change not to much to avoid a lot of new problems.

I have checked out code to avoid the questions from asksign in the
routine risplit-expt. Now we get the general form for expressions when
the sign is not known, e.g.

Realpart and imagpart of the sqrt function:

(%i3) realpart(sqrt(x+%i*y));
(%o3) (y^2+x^2)^(1/4)*cos(atan2(y,x)/2)
(%i4) imagpart(sqrt(x+%i*y));
(%o4) (y^2+x^2)^(1/4)*sin(atan2(y,x)/2)

Realpart and imagpart of the asin function:

(%i5) realpart(asin(x+%i*y));
(%o5) -atan2(((y^2-x^2+1)^2+4*x^2*y^2)^(1/4)*sin(atan2(2*x*y,y^2-x^2
+1)/2)-x,
             ((y^2-x^2+1)^2+4*x^2*y^2)^(1/4)*cos(atan2(2*x*y,y^2-x^2
+1)/2)-y)
(%i6) imagpart(asin(x+%i*y));
(%o6) -log((x-((y^2-x^2+1)^2+4*x^2*y^2)^(1/4)*sin(atan2(2*x*y,y^2-x^2
+1)/2))^2
            +(((y^2-x^2+1)^2+4*x^2*y^2)^(1/4)*cos(atan2(2*x*y,y^2-x^2
+1)/2)-y)
             ^2)
       /2

This simplifies further when the sign is known:

(%i7) assume(x>0,y>0);
(%o7) [x > 0,y > 0]

(%i8) realpart(sqrt(x+%i*y));
(%o8) sqrt(sqrt(y^2+x^2)+x)/sqrt(2)
(%i9) imagpart(sqrt(x+%i*y));
(%o9) sqrt(sqrt(y^2+x^2)-x)/sqrt(2)

(%i12) rectform(sqrt(x));
(%o12) sqrt(x)
(%i13) rectform(sqrt(-x));
(%o13) %i*sqrt(x)

Furthermore some bugs which involve the integration of such expressions
vanish.

With this change there are no more asksign in the code of risplit or
absarg.

Dieter Kaiser