I was actually thinking, during the previous thread involving Complex numbers 

It may not have any practical use, but if one wanted to define an ordering for complex numbers that was deterministic and relatively unbiased, a way to do this would be based on what I'll call for now the "spiral distance".

Conceptually, you take an infinite length spiral line that starts at and is centered on the origin, where for each turn the current spot on the spiral increases an infinitesimal radius from the origin, or a distance approaching zero, in the calculus sense. Complex numbers closer to the origin on the spiral will be ordered earlier than those further from the spiral.

Actually calculating this is a simple comparison of the radius and angle components of the two complex numbers in the polar coordinate system. If the radius value is different, then the one with the smaller radius is ordered before the one with the larger; if the two radius values are the same, then the one with the smaller angle is ordered first; if both are the same, then the two complex numbers are equal.

The math is just as simple as a naive comparison that just compares the real component and then imaginary component in a cartesian coordinate system, but the result is much more reasonable I think.

This whole principle of "distance from origin" method of ordering does also, I suspect, scale to any number of dimensions; the one-dimensional version is simply comparing first the absolute value of the two numbers, and then saying that either the positive or negative version orders first.

-- Darren Duncan

Reply via email to