Currently, conjugate has logic in it that I think should be
handled by featurep(. , real) or featurep(. , imaginary).
Before conjugate is changed, featurep(.,real) needs to be
clarified:
It seems that rectform believes that 'x' is real, but featurep doesn't:
(%i1) rectform(x);
(%o1) x
(%i2) featurep(x,real);
(%o2) false
But featurep does think x[1] is real:
(%i3) featurep(x[1], real);
(%o3) true
Here are two designs for featurep(.,real).
Plan A:
featurep(e,real) --> true iff freeof(rectform(e),%i) --> true.
Note: It's up to rectform to check declare information--generally
I think rectform does this.
Pros: Simple to code, easy to document. Makes featurep(. , real) consistent
with rectform. Improving rectform will also improve featurep(. , real).
Cons: The function 'rectform' can ask questions. This violates
the featurep documentation that states "...has the feature
on the basis of the facts in the current database." (Note *current*)
Plan B:
featurep(e,real) --> true iff
(1) e is a Maxima number (rational, float, or big float) or
(2) e is a maptom and e featurep(e, complex) --> false and
featurep(e,imaginary) --> false or
(3) e is a subscripted variable and featurep(op(e),real) --> true or
(4) featurep(op(e),'realvalued) or
(5) featurep(op(e),mapsrealstoreals) and every(lambda([s], featurep(s,
real)), args(e)).
Notes:
realvalued and mapsrealstoreals aren't features, but they could be.
The functions realpart, imagpart, ... would be declared to be realvalued.
We'd need to declare %i to be imaginary and infinity to be complex.
Condition (3) makes featurep(x[%i], real) --> true. Oh whatever....
Pros: No questions from rectform. Fairly easy to code and document.
Changes to rectform could make rectform and featurep(., real)
inconsistent.
Cons: featurep(asin(x), real) --> false even when it's been assumed
that -1 <= x <= 1. This could be repaired by telling Maxima the
real domain for a few dozen functions. If we did this, we could
have hard to find inconsistencies with rectform. This would be
a much larger project. Also it would have to give up on most
expressions: featurep(asin(x + log(1-x^2), real) (Not able to
determine if -1 <= x + log(1-x^2) <= 1.)
Plan C?
Barton