I was going to suggest this too, but the RIF behaves differently than you might naively expect "intervals" of real number to behave. For example, "union" means convex hull:
sage: a = RIF(0,1) sage: b = RIF(2,3) sage: a.union(b).endpoints() (0.000000000000000, 3.00000000000000) Also, it seems from the documentation that RIF intervals are only designed to represent closed intervals { x : a <= x <= b } It seems like it would be relatively easy to implement a Sage class for real intervals that represents finite unions of open, closed, half open, and unbounded intervals and implements union() and intersection() methods. -Benjamin Jones On Dec 9, 8:21 pm, Marshall Hampton <hampto...@gmail.com> wrote: > I think you want the RealIntervalField. For exampe: > > sage: a = RIF(0,1) > sage: b = RIF(.5,pi) > sage: a.overlaps(b) > True > > see:http://www.sagemath.org/doc/reference/sage/rings/real_mpfi.html > > -M. Hampton > > On Dec 9, 8:16 am, Laurent Claessens <moky.m...@gmail.com> wrote: > > > > > > > > > Hi > > > I would like to work with sets that are real intervals or combinations > > of them : mainly intersection and union. > > Example : > > [0,1] intersection with [0.5 , pi] > > > Using the Sage Reference Manual 4.1.1, I was able to do that : > > > sage:A=Set(RealField()) > > sage: sqrt(2) in A > > True > > > So it is possible to consider parts of R as sets. How can I build an > > interval ? > > > Have a good day > > Laurent Claessens > > > PS : I send this message by email on December, 4. Since I did not even > > saw my message appearing, I decided to repost it from the GoogleGroup > > online interface. I'm wrong in doing that ? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org