Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge #32015
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jul 11, 2021
2 parents 1eb270a + 753babb commit 141ecde
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/sage/interfaces/sympy_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ def _sage_(self):
EXAMPLES::
sage: F = Set([1, 2])
sage: F is Set([1, 2])
sage: F = Family([1, 2])
sage: F is Family([1, 2])
False
sage: sF = F._sympy_(); sF
SageSet({1, 2})
SageSet(Family (1, 2))
sage: sF._sage_() is F
True
"""
Expand All @@ -82,7 +82,7 @@ def is_empty(self):
EXAMPLES::
sage: Empty = Set([])
sage: Empty = Family([])
sage: sEmpty = Empty._sympy_()
sage: sEmpty.is_empty
True
Expand Down
15 changes: 13 additions & 2 deletions src/sage/sets/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,12 +1206,23 @@ def _sympy_(self):
sage: X = Set({1, 2, 3}); X
{1, 2, 3}
sage: X._sympy_()
sage: sX = X._sympy_(); sX
Set(1, 2, 3)
sage: sX.is_empty is None
True
sage: Empty = Set([]); Empty
{}
sage: sEmpty = Empty._sympy_(); sEmpty
EmptySet
sage: sEmpty.is_empty
True
"""
from sympy import Set
from sympy import Set, EmptySet
from sage.interfaces.sympy import sympy_init
sympy_init()
if self.is_empty():
return EmptySet
return Set(*[x._sympy_() for x in self])


Expand Down

0 comments on commit 141ecde

Please sign in to comment.