Python has a builtin set data type. For example: >>> x= [1,2,3,5,2,1] >>> set(x) set(1, 2, 3, 5)
Sympy has an Interval class, but it seems at the moment it doesn't have things like the intersection / union operators, nor whether the interval is open or closed. I'm not sure if this Interval class was intended for the application you mentioned, but if so, we should add some functionality, it wouldn't be very hard. The file is: sympy/core/interval.py Useful methods to add that I can think of: -- union / intersection / difference -- open / closed -- force start to be <= end ??? so that you couldn't make an interval like: [2, 1]? ~Luke On Jul 3, 10:44 am, Christophe <projet...@gmail.com> wrote: > Hello, > I would like to know if it is possible to work with sets. > > A second question. Is the a way to do something like intersection([1 ; > 2];[1.5 ; 5]) and union([1 ; 2];[1.5 ; 5]) where [a ; b]:={x | > a<=x<=b}? > > Best regards. > Christophe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---