[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: Common-Lisp @ SU-AI, fateman @ UCBKIM*Subject*: Gaussian rationals*From*: Alan Bawden <ALAN @ MIT-MC>*Date*: Sun, 05 Jun 1983 08:31:00 -0000*Cc*: Moon @ SCRC-TENEX

The point is that -1 and -1+0*i are the same number in any clear way of thinking about the situation. To muddy the essential mathematics of the situation (that the real rationals are a sub-field of the Gaussian rationals) because of a user-interface issue (what users expect of certain transcendental functions), is downright wrong. I note that only a few transcendental functions have the potential user-interface problem alluded to. By the nature of a field, no rational function can escape from the reals. The GCD and LCM functions behave the same way when restricted to the ring of integers as they do when their domain is taken to be the ring of Gaussian integers. The NUMERATOR and DENOMINATOR functions can consequentially be naturally extended to Gaussian rationals. Various other miscellaneous functions like ABS and SIGNUM also naturally extend to the complex case. Only a handful of transcendental functions that have been traditionally expected to err when given certain real arguments, could now be expected to yield a complex result. The functions in question are: LOG, SQRT, ASIN, ACOS, ACOSH, and ATANH. If anyone can find any more, they should speak up. Not coincidentally, these are all functions that require the specification of branch cuts. These are also all functions that deal in floating point values. (Because floating point is the usual representation chosen for transcendental numbers. Another unfortunate tradition, but not one we are currently in a position to challenge.) Not being a great fan of floating point, I don't like being in a position where I have to suggest anything about these functions. However, since I seem to be the one on the crusade to clean up the Gaussian rationals, I feel I must make some proposal about what to do about these six functions. I'll offer 4 possibilities: 1. Surprise everyone. In Common Lisp, these six functions are complex-valued. People who expect (SQRT -1) to err are wrong. (I would favor this myself, but I appreciate the arguments against it.) 2. These six functions are real-values only. Introduce six more functions that have the full complex range. Nobody is surprised. People who want complexes say (COMPLEX-SQRT -1). (Actually more than six functions would need to be introduced; I presume we would want a COMPLEX-ASINH to match COMPLEX-ACOSH etc.) 3. These six functions are complex-valued as in 1., and we additionally introduce six new functions that are real-valued. People who want (SQRT -1) to be an error, have to say (REAL-SQRT -1) instead. (Again, more than six are really necessary.) 4. Since in all cases the answer is floating point, and since -1.0 and #C(-1.0 0.0) really ARE different, define these functions to return a complex result (in the questionable part of their domains) ONLY if given a floating point complex argument. Thus (SQRT -1), and (SQRT -1.0) are both errors, but (SQRT #C(-1.0 0.0)) is not. To get the effect of the COMPLEX-SQRT function, you would write something like (SQRT (COMPLEX X 0.0)). If we were to decide to do this, then the next issue we get to haggle is what (SQRT #C(1 1)) does (since you can hardly regard 1+i a a "questionable" part of the domain of SQRT!).

- Prev by Date:
**Re: Volume of mail (trivia)** - Next by Date:
**Gaussian rationals** - Previous by thread:
**Re: Gaussian rationals** - Next by thread:
**Gaussian rationals** - Index(es):