Thanks for the explanations.  Are there other classes where there are
many different output representations, controlled by parameters to the
str() function istead of by setting defaults for the class?

John

On 6 August 2013 14:31, Jason Grout <[email protected]> wrote:
> On 8/6/13 8:10 AM, John Cremona wrote:
>>
>> I really hope there is some clearer documentation than those code
>> comments, since I am even more confused after reading that than after
>> seeing the original post.
>>
>> sage: a = RIF(1.332,1.334)
>> sage: a.center()
>> 1.33300000000000
>> sage: a
>> 1.34?
>>
>> The center is 1.33 and we know that the value is "really" between
>> 1.332 and 1.334 so the first two decimal places after the point are
>> certainly 33.  How on earth is 1.34? supposed to convey that?
>
>
> First of all, note that 1.333? would not be valid since the right endpoint
> is really 1.3340000000000001 (1.334 is not exactly representable, and it is
> rounded up).  So we're deciding between 1.33? and 1.34?.  The way I
> understand it, since they both have the same precision, the number farther
> from zero is picked.  I think I agree with you, though, that in this case
> having a number that is more central is more important than picking the
> number farthest from zero.
>
> It would make more sense to ask if the lower endpoint of the printed
> representation is the same sign as the upper endpoint of the printed
> representation (e.g., sign(1.33-.01)==sign(1.33+.01)), and if it is, use the
> more natural 'center' point (i.e., the number closer to the center of the
> interval), instead the point farthest from zero.  Then we get intervals that
> are obviously all the same sign when it's important, and more natural
> representations otherwise.
>
>
>>
>> On Sage 5.11.beta3 I get
>>
>> sage: a = RIF(0,123)
>> sage: a
>> 1.?e2
>>
>> and not '62.?62' which I suppose is intended to convey "61.5
>> plus-or-minus 61.5'.  So is that comment in the code out of date?
>>
>
> Note that it says "with 2 error digits":
>
> sage: RIF(0,123).str(error_digits=2)
> '62.?62'
>
>
>> I think the interval arithmetic is great, and very useful, but the
>> output format is so bizarre I wonder whether if it is putting users
>> off using it.
>
>
> That's a good question; anyone else want to comment?  You can also change
> the default formatting by setting a module variable.
>
> sage: sage.rings.real_mpfi.printing_style='brackets'
> sage: RIF(0,123)
> [0.00000000000000000 .. 123.00000000000000]
>
>
>
> Thanks,
>
> Jason
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to