On Sun, Sep 06 2015, Pรกll Haraldsson <[email protected]> wrote:

> On Friday, August 28, 2015 at 10:28:39 AM UTC, Andreas Lobinger wrote:
>>
>>
>>> that is the right thing. I wander what MATLAB does, since all numbers(?)
>>> are stored as complex. 0im special cased?
>>>
>>
>> yes. Only real part is compared, if you need abs(a) > abs(b) or similar.
>>
>
> I wander, since MATLAB compares/orders complex numbers, if Julia should too.
>
>
> http://www.cut-the-knot.org/do_you_know/complex_compare.shtml
> "It's actually possible to define the relationship "<" between complex
> numbers. [..] Still it's not very useful. To see what the problem is let's
> turn to the multiplication."
>
>
> It seems for sorting/datagrids, etc. (DataFrames.jl) you might want this.
>
>
> Does it lead to something very bad? Would if be helpful to special-case
> then only sort! and not isless in general?

Your problem --- the problem with this whole thread --- is that you
don't have a specific application or question in mind; and thus the
whole conversation is idle, aimless speculation.

You can always define a total order on complex numbers etc, in fact you
can define many; take any function f:C->R and define a < b iff f(a) <
f(b) (lexicographic orders are another possibility that cannot be
defined this way).

The question is whether a particular order makes sense, but to answer
that you need an application. Particular choices of f make sense for
particular applications. Not imposing any particular order for complex
numbers etc is a wise design choice, since there is no order that is
generally used.

Best,

Tamas

Reply via email to