On Jul 13, 1:57 pm, saucerful <[EMAIL PROTECTED]> wrote:
> I see.  Yes I agree it should be false.  Consider:
>
> CIF(RIF(0)) != CIF(RIF(-1, 1))
> True
>
> RIF(0, 0) != RIF(-1, 1)
> False
>
> That these two comparisons should be different makes no sense, does
> it?

Yes, there's probably a bug here, and it's all my fault :)

But I'm not sure exactly where the bug is.

For real intervals A and B, and comparison operators ==,!=,<,etc., we
define
A OP B iff (for all real numbers a in A, b in B, a OP b).

This has several good properties (and several bad properties as well);
in particular, "A == 1" does what I consider the right thing, and all
of the comparison operators are useful.

But this definition is less useful for complex intervals, since
complex numbers don't have a useful ordering.  In Sage, we do define
less-than for complex numbers (it's the lexicographic ordering), but
that doesn't give a useful meaning for A<B for complex intervals.

Since I couldn't think of a mathematically useful definition for A<B,
I decided to go for a definition that would be useful in CS terms:
"""        Intervals are compared lexicographically on the 4-tuple
        (x.real().lower(), x.real().upper(), x.imag().lower(),
x.imag().upper())
"""
At least this is a total ordering, so complex intervals could be
sorted; and it does the right thing for equality.  I guess I just
didn't think about the fact that it does the wrong thing for
inequality.

So I see a few options here:
1) do nothing
2) change the definition of inequality on CIF to match RIF, but leave
the ordering operations as lexicographic
3) change the definition of all comparison operators on CIF to match
RIF (giving us probably-useless ordering operations, but at least the
formal definition would be consistent with RIF)
4) change RIF somehow

Any votes, or suggestions for other options?

> Also why is it that CIF(0) seems to not have an interval, while CIF(1)
> does?

It's just a printing issue, inherited from CC.

Carl

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to