Subject: Comments on realp; Was: featurep(e, real)
From: Stavros Macrakis
Date: Mon, 15 May 2006 13:27:36 -0400
Some thoughts on featurep(,real) etc. Not directly pertinent, but....
Maxima by default assumes that all variables are real-valued. This allows
it to assume, for example, that x^2 >=0 for all x, and that
realpart(x+%i*y)=x.
Declaring z complex is supposed to override this default. So, for example,
(declare(z,complex),realpart(z)) => 'realpart(z). But most of Maxima
ignores it: is(z^2>=0) still returns true, and diff('realpart(z),z) returns
'realpart(1), where in fact the derivative is undefined.
Setting domain:'complex is supposed to override this default assumption, and
assume that all variables are by default complex, requiring the declaration
declare(x,real) to override that. However, domain is ignored by most of
Maxima, so for example (domain:'complex, realpart(q)) => q and not
'realpart(q).
So the behavior of featurep should presumably depend on both the declaration
database and the current setting of domain.
I agree with Barton that "maps_real_to_real" is a different property from
"real_valued". Very few functions are real-valued for all arguments:
realpart, imagpart, abs are all I can think of. Many map reals to reals.
Rectform does currently know that asin is real for abs(argument)<=1
By the way, signum(%i) currently returns a nounform; shouldn't it give an
error...?
-s