upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

Interval comparison #151

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Intervals could be made comparable. They could implement triple-valued
logic (like SymPy expressions):

x < y == True if x.b < y.a
x < y == False if y.b <= x.a
x < y == None otherwise

Then some more (but far from all) generic code should start working with
intervals. Also, there's not really any need for absmin and absmax and
similar functions.

Original issue reported on code.google.com by fredrik....@gmail.com on 10 Jun 2009 at 10:45

GoogleCodeExporter commented 9 years ago
+one

Returning None for a comparison might be unexpected, so I think absmin/max are 
still
needed.

Original comment by Vinzent.Steinberg@gmail.com on 10 Jun 2009 at 11:20

GoogleCodeExporter commented 9 years ago
I don't think it should lead to much confusion if it's well documented.

Original comment by fredrik....@gmail.com on 10 Jun 2009 at 11:32

GoogleCodeExporter commented 9 years ago
Yeah, LU_decomp just would have to be fixed to expect None from comparisons,
otherwise None <=> False.

Original comment by Vinzent.Steinberg@gmail.com on 10 Jun 2009 at 11:49

GoogleCodeExporter commented 9 years ago
Some code that looks like

if x < y:
    foo
else:
    bar

could be rewritten as

if x < y:
    foo
elif x >= y:
    bar
else:
    baz

Original comment by fredrik....@gmail.com on 11 Jun 2009 at 11:02

GoogleCodeExporter commented 9 years ago
Implemented as part of  r1124; there could be some subtleties left to sort out.

Original comment by fredrik....@gmail.com on 14 Apr 2010 at 3:15