Comments on realp; Was: featurep(e, real)



On 5/15/06, Joel Salomon <joelcsalomon at gmail.com> wrote:
>
> On 5/15/06, Stavros Macrakis <macrakis at gmail.com> wrote:
> > By the way, signum(%i) currently returns a nounform; shouldn't it give
> an error...?
>
> Shouldn't signum(%i) return %i ?
>

Signum(x) is well-defined for the reals.  You could certainly imagine
extending it in various ways to the complex numbers.  One natural way is:

     signum(z):=if z=3D0 then 0 else exp(%i*carg(z))

The main problem with this is that every existing use of signum assumes that
its argument is real, and that it returns 1, 0, -1, or a nounform.  Another
problem is that carg always tries to resolve sign (using asksign if
necessary), whereas signum is 'lazy', only using sign.  Finally, I am not
sure when users would actually want this behavior.

By the way, shouldn't we develop a vocabulary for the different ways that
functions treat uncertainty? Here are the cases:

  -- err out: 'is'
  -- ask the user: asksign and functions which use it: rectform, integrate,
limit, atan2, ...
  -- return a nounform: abs, signum, ...
  -- return a special representation of the uncertainty: sign, maybe, limit
(when asking doesn't help), ...

It would be nice if these corresponded cleanly to functionality, e.g.
form-transforming functions (rectform), simplifying functions (abs, but
atan2 is an exception), mathematical analyses (integrate, limit), etc. but
they don't quite.

          -s