On Mar 16, 1:52 pm, epple <dedaa...@gmail.com> wrote:
> When comparing finite sets, I receive unexpected results.
> Version: 3.4 (Sage on the web)
> Code:
> sage: S=Set([1,2])
> sage: T=Set([3])
> sage: S<T,S>T,S==T
> (True, False, False)

As far as I can tell, for Sets, == and != mean what they should, while
< and > are not very helpful.  (I think that S<T is True if and only
if S is not equal to T, while S>T is always False.)

> The output seems to be the same whatever I put in for S and T, as long
> as I don't make them equal. Is there another easy way to compare two
> sets (or the underlying sets of two lists) without writing a routine
> for it?

Convert S and T to sets (instead of Sets):

sage: S.set().issubset(T.set())

or just use Python sets instead of Sage Sets:

sage: S = set([1,2,3])
sage: T = set([3])
sage: S.issubset(T)
False
sage: S.issuperset(T)
True
sage: T.issubset(S)
True

Is this the sort of thing you want?

--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to