Am Mittwoch, den 16.09.2009, 07:24 -0500 schrieb Barton Willis:
> Should csign(log(x)) --> complex or pnz? More generally, if csign returns
> complex,
> does this mean that the expression is non-real for all inputs or non-real
> for some
> inputs?
Hello Barton,
your comments are right.
The handling of functions by $csign is not complete and consistent. More
work is possible and necessary.
Now, all functions are assumed to be real valued for a real or a complex
argument.
(%i1) csign(f(x));
(%o1) pnz
(%i2) declare(z,complex);
(%o2) done
(%i3) csign(f(z));
(%o3) pnz
But not in all cases as you have observed for the log function:
(%i8) csign(log(x));
(%o8) pnz
(%i9) csign(log(z));
(%o9) complex
Now, we have to declare the symbol for the function to be complex to get
a complex answer:
(%i10) declare(f,complex)$
(%i11) csign(f(x));
(%o11) complex
The time I have worked on the complex components I have hesitated to
change the behavior that every function is assumed to have real values.
The problem is, that a lot of known results will change. Furthermore I
have not seen in fully depth all relations between the different
routines for the complex components which might cause subtle bugs.
But I think we should improve the complex behavior step by step to get
more nice results.
By the way: I think it is important too to improve the sqrt function,
see the bugs sqrt(1/x) -> 1/sqrt(x) and sqrt(%i/x) -> -%i/sqrt(x), to
get more correct results for complex expressions.
Dieter Kaiser