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
>>> think that in this case, the interval arithmetic requirement is more
>>> specific, so you should be consistent with having intervals.
>>>
>>
>> Well, I guess this depends on your point of view. Robert B. and I
>> chatted about this thread when it started, and I think he  
>> convinced me
>> that the "right" point of view is that RIF is supposed to be a model
>> of \mathbb{R} that keeps track of errors for you -- that RIF is a
>> drop-in replacement for, say, RDF, and that it keeps track of
>> precision as you go. From this point of view, I think there's no
>> question of what the behavior of floor() should be.
>>
>> On the other hand, if you're just thinking of intervals as
>> intrinsically interesting objects, maybe this isn't as natural? I
>> guess I can just put the ball back in your court: Jason, what do
>> intervals mean to you? ;)
>
> I agree with Robert; at least, that is my use-case for using intervals
> next semester in teaching numerical analysis.
>
> 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()

Are you surprised that

sage: a = sin(floor(RDF(1.5)))
sage: a.prec()

doesn't work?

> versus
>
> a=sin(floor(RIF((1.5,2.5))))
> a.lower()
> a.upper()
>
> In other words, I don't think that the return type of floor() should
> depend on how big the interval is.

That's not what I was suggesting, I think it should be an exception  
if there is not a unique floor. If you want all possible floors, you  
can always do

sage: a = RIF(1.5, 2.5)
sage: floor(a.lower())
1
sage: floor(a.upper())
2

but I think this is the exception. In the typical case (small  
diameter) there is one actual value, and it's known exactly (i.e.  
there's no more error to keep track of).

> If you are keeping track of errors, then I think floor(RIF(1.5, 2.5))
> should return an interval (possibly a discrete analog, i.e., just the
> integers [1,2] in a class that acts like an interval).  Thus, I think
> that floor(an interval in which all numbers have the same interval)
> ought to return an interval, where both endpoints are the same.

A discrete analog would be interesting, though it quickly leads to a  
combinatorial explosion of possibilities after a couple of arithmetic  
operations. I still don't think it's the right answer though--it  
forces people to handle the RIF differently than all other floating  
point models we have, and makes RIF less useful as a drop-in  
replacement.

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to