(I received the following email from Eugene McDonnell -- he has graciously granted me permission to repost it in this wiki. -- Raul)

Shortly before he left IBM Research in 1968, to go to work as a VP for newly-started STSC (Al Rose had already gone there), Larry Breed asked me, "How can the APL residue function be extended to complex numbers?" I kicked this question around for several weeks, and finally concluded two things: that the existing residue function must be changed, and the floor function was critical. Here's how residue was defined in the 1968 APL\360 User's Manual:

```A | B for A ~: 0 is B - (|A) * <.  B % | A
A | B for A = 0 and B >: 0 is B
A | B for A = 0, B < 0 is domain error```

This would never work in the complex domain. I persuaded Ken and Adin that the definition has to revert to the one given in the 1966 APL\360 manual: B - A * <. B % A.

For the floor function, I required these:

1. Existence: Every number has a floor.
2. Uniqueness: Every number has only one floor.
3. Fractionality: The magnitude of the difference between a number and its floor is less than one.
4. Integrity: The floor of a number is an integer.
5. Convexity: If G is the floor of Z and W, it is also the floor of all numbers on line ZW.
6. Translation: For C any integer, C + <. Z matches <. C + Z.

7. Compatability: The complex floor function is compatible with the real floor function.

The fractional part of a number n can be determined by 1 | n, and is less than 1 and ge 0; it lies on the real number line [0 1). In order to define fractional part of complex z, I had to define "fractional part" of a number to lie within a rectangle with sides %:2 and %:%2, and with vertices at 0j1, 1, 0.5j_0.5, and _0.5j0.5. This ensures that the real fractional parts are a subset of the complex fractional parts, and that the magnitude of a complex fractional part will be less than 1.

To bolster my confidence in this definition, I tried to extend it to higher dimensions. In the 3-D case, I found that a compatible extension is obtained with a hexagonal prism of height (%:3)%3, length of side %:2%3, and alternate vertices of the upper face separated by %:2, and positioned at (0, 0, 1), (0, 1, 0), and (1, 0, 0), and the center of the lower face at (0, 0, 0). This prism has volume 1, and contains both real and complex fractional parts, and satisfies all my requirements.

I found that a compatible extension of this construction to the quaternions requires that the quaternion integers include not only those with all-integer parts, like 2i3j5k7 but must also include those all of whose fractional parts are 1r2. I believe I found this in a book by either Adrian Albert or L. E. Dickson. This definition allows my requirements to be satisfied by a half-tesseract with vertices a+bj+ck+dl located at these 16 vertices:

 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

and its negation; and

 0.5 0.5 0.5 _0.5 0.5 0.5 _0.5 0.5 0.5 _0.5 0.5 0.5 _0.5 0.5 0.5 0.5

and its negation.

System/Requests/Quaternions/NumberTheoryForQuaternions (last edited 2010-02-14 18:02:50 by DevonMcCormick)