featurep(e, real)



On 5/16/06, Robert Dodier <robert.dodier at gmail.com> wrote:
>
> On 5/15/06, Stavros Macrakis <macrakis at gmail.com> wrote:
>
> > What "nuttiness" did you have in mind?
>
> Oh, I don't know. This looks pretty nutty to me.
>
> (%i8) declare (X, complex);
> (%o8)                         done
> (%i9) rectform (log (X));
> Is  X  positive or negative?


That is a simple bug, not nuttiness.  Rectform(X) correctly returns
'realpart(X)+%i*'imagpart(X).  Polarform gets it wrong.

> What do you suggest the value of featurep(sqrt(x),real) be in the absence
> of asksign?
>
> featurep (x, real) and x >= 0 -- that's correct, isn't it?



The right way to protect a function which doesn't cover all the bases is to
> propagate a boolean or conditional expression through it as a matter of
> course.


I basically agree with you.  I think in fact that I initiated the discussion
on conditional expressions several *years* ago.  However, featurep (like
sign, etc.) is a *programming tool*, not a mathematical function.  It is
useful for dispatching on the result.  I don't think it's useful or helpful
for it to return a conditional expression.

How about evaluating the offending expression (say foo)
> to undefined (foo) ? E.g. 1/0 =3D> undefined (1/0) ,


This might be OK if Maxima knew how to manipulate these things, e.g.
undefined(1/0)-undefined(1/0) should not simplify to 0, as you say (the
gensym solution has been discussed before, though it adds yet another
confusing issue for the user...).  But I also don't see what the point of
this is.  These error objects will end up propagating into more and more
complicated expressions, e.g. if undefined(1/0)=undefined(0^0) then 1 else 2
etc. etc.  What is the point of those?  They simply obscure the source of
the problem.

As Barton put it, I don't want to wait to find out that I've pumped diesel
into my car until after ruining my motor.  I don't even want my very clever
car to centrifuge my fuel and use the gasoline first and then tell me 100
miles later that I can't go further when it hits the diesel.


> signum (%i) => undefined (signum (%i)) . If the user must see an explicit
> error message, it would be easy to set up a global flag (ugh) which
> simplifies undefined to merror.


         -s