[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-19 Thread Robert Bradshaw
On Sep 19, 2009, at 9:56 PM, Jason Grout wrote: > Craig Citro wrote: >>> Okay, that seems like a valid point, though I still disagree. I >>> think >>> that we have two levels of consistency here: consistency with the >>> function and consistency with the concept of interval arithmetic. I >>> t

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-19 Thread Craig Citro
> I speak from a programmatic point of view, though.  I'd like to not be > surprised that the following doesn't work: > > a=sin(floor(RIF( (1.1,1.2) ))) > a.lower() > a.upper() > > > versus > > a=sin(floor(RIF((1.5,2.5 > a.lower() > a.upper() > I'm a little confused -- *neither* of those woul

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-19 Thread Jason Grout
Craig Citro wrote: >> Okay, that seems like a valid point, though I still disagree. I think >> that we have two levels of consistency here: consistency with the >> function and consistency with the concept of interval arithmetic. I >> think that in this case, the interval arithmetic requirement i

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-19 Thread Craig Citro
> Okay, that seems like a valid point, though I still disagree. I think > that we have two levels of consistency here: consistency with the > function and consistency with the concept of interval arithmetic.  I > think that in this case, the interval arithmetic requirement is more > specific, so y

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-19 Thread Jason Grout
Craig Citro wrote: > > So I think that this suggests returning an Integer is the right move > -- it's just a question of what to do if there *is* no single correct > integer. Okay, that seems like a valid point, though I still disagree. I think that we have two levels of consistency here: cons

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-19 Thread Nick Alexander
>> Well, I'm a little confused -- I thought that the whole point of >> floor() and ceil() was to return Integers. Indeed: In my opinion, this is a huge +1. Nick --~--~-~--~~~---~--~~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscri

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread William Stein
On Fri, Sep 18, 2009 at 7:13 PM, Craig Citro wrote: > >> I really think that floor, ceil, and round should return intervals when >> they are fed intervals.  I thought that was the whole point of interval >> arithmetic.    Shouldn't sin(floor(interval)) be an interval?  It won't >> be if floor aut

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Craig Citro
> I really think that floor, ceil, and round should return intervals when > they are fed intervals.  I thought that was the whole point of interval > arithmetic.    Shouldn't sin(floor(interval)) be an interval?  It won't > be if floor automatically converts things to integers.  Why should > floor

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Jason Grout
Craig Citro wrote: > So there are two things people could want from an interval i: > > 1) { floor(x) for x in i } > 2) min { floor(x) for x in i } > > I think that David's unhappy with floor doing (2). The other proposal > is to have x.floor() return the unique element in (1) when it's a > singl

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Craig Citro
So there are two things people could want from an interval i: 1) { floor(x) for x in i } 2) min { floor(x) for x in i } I think that David's unhappy with floor doing (2). The other proposal is to have x.floor() return the unique element in (1) when it's a singleton, and raise an exception otherw

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Nick Alexander
On 17-Sep-09, at 3:16 PM, David Harvey wrote: > > I disagree with this change. One of the main purposes of interval > arithmetic is to be able to take a function f(x) that operates on > floats, and pass in intervals instead, to determine the possible range > of outputs a given input interval cou

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Nick Alexander
On 18-Sep-09, at 4:22 PM, Craig Citro wrote: > >> Example: >> >> sage: floor(log(RIF(8)) / log(RIF(2))) >> 3.? >> >> Should this be 2? What if it returned an Integer if there was a >> unique floor (ceiling, etc.) and raised an exception otherwise? >> > > I'm +1 on x.floor()/x.ceil() returning an

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Craig Citro
> Example: > > sage: floor(log(RIF(8)) / log(RIF(2))) > 3.? > > Should this be 2? What if it returned an Integer if there was a > unique floor (ceiling, etc.) and raised an exception otherwise? > I'm +1 on x.floor()/x.ceil() returning an Integer when possible, and raising an Exception otherwise.

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Craig Citro
>> I propose, but I'm perhaps missunderstanding. >> >> a.lower().floor() >> a.upper().ceil() >> a.center().round() > > I know about those and always eventually end up using them.  But I > don't consider them "easy". > Maybe include them and call them something like "ilower" and "iupper"? I'm mode

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Jason Grout
William Stein wrote: > On Fri, Sep 18, 2009 at 9:53 AM, Francois Maltey wrote: >> Hello, >>> sage: a = RIF(1.5,2.3) >>> >>> I see no way to easily get 1 2 or 3 from a. >>> >> I propose, but I'm perhaps missunderstanding. >> >> a.lower().floor() >> a.upper().ceil() >> a.center().round() > > I kno

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread William Stein
On Fri, Sep 18, 2009 at 9:53 AM, Francois Maltey wrote: > > Hello, >> sage: a = RIF(1.5,2.3) >> >> I see no way to easily get 1 2 or 3 from a. >> > > I propose, but I'm perhaps missunderstanding. > > a.lower().floor() > a.upper().ceil() > a.center().round() I know about those and always eventual

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Francois Maltey
Hello, > sage: a = RIF(1.5,2.3) > > I see no way to easily get 1 2 or 3 from a. > I propose, but I'm perhaps missunderstanding. a.lower().floor() a.upper().ceil() a.center().round() François --~--~-~--~~~---~--~~ To post to this group, send an email to sage-d

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread William Stein
On Fri, Sep 18, 2009 at 7:06 AM, Jason Grout wrote: > > Robert Bradshaw wrote: >> On Sep 17, 2009, at 3:16 PM, David Harvey wrote: >> >>> I disagree with this change. One of the main purposes of interval >>> arithmetic is to be able to take a function f(x) that operates on >>> floats, and pass in

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Jason Grout
Robert Bradshaw wrote: > On Sep 17, 2009, at 3:16 PM, David Harvey wrote: > >> I disagree with this change. One of the main purposes of interval >> arithmetic is to be able to take a function f(x) that operates on >> floats, and pass in intervals instead, to determine the possible range >> of out

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-17 Thread Robert Bradshaw
On Sep 17, 2009, at 10:44 PM, Robert Bradshaw wrote: > On Sep 17, 2009, at 3:16 PM, David Harvey wrote: > >> I disagree with this change. One of the main purposes of interval >> arithmetic is to be able to take a function f(x) that operates on >> floats, and pass in intervals instead, to determin

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-17 Thread Robert Bradshaw
On Sep 17, 2009, at 3:16 PM, David Harvey wrote: > I disagree with this change. One of the main purposes of interval > arithmetic is to be able to take a function f(x) that operates on > floats, and pass in intervals instead, to determine the possible range > of outputs a given input interval cou

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-17 Thread David Harvey
I disagree with this change. One of the main purposes of interval arithmetic is to be able to take a function f(x) that operates on floats, and pass in intervals instead, to determine the possible range of outputs a given input interval could produce. This change violates that paradigm. The author

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-17 Thread Nick Alexander
On 17-Sep-09, at 12:53 AM, Jason Grout wrote: > > Currently, round(), floor(), and ceil() on interval objects return > intervals. > > There is a patch up at #2899 that changes these functions to return > integers (round-> "round the midpoint", floor -> largest integer below > the bottom of the i

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-17 Thread Francois Maltey
William Stein wrote : > 2009/9/17 Jason Grout : > >> Currently, round(), floor(), and ceil() on interval objects return >> intervals. >> >> There is a patch up at #2899 that changes these functions to return >> integers (round-> "round the midpoint", floor -> largest integer below >> the bottom

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-17 Thread William Stein
2009/9/17 Jason Grout : > > Currently, round(), floor(), and ceil() on interval objects return > intervals. > > There is a patch up at #2899 that changes these functions to return > integers (round-> "round the midpoint", floor -> largest integer below > the bottom of the interval, etc.).  I think