Repository: sympy/sympy

Issue:
FiniteSet contains equal Elements
When defining a FiniteSet like this:
`FiniteSet(I*7+I*(sqrt(7)-7), I*5+I*(sqrt(7)-5))`
It keeps both elements, even though they are equal (`I*sqrt(7)`). I think equality in FiniteSets should be checked with `.equals()`, but at the moment I think its checked with `hash()` as FiniteSet in its core uses a `set()`.



Discussion:

Patch:
diff --git a/sympy/sets/sets.py b/sympy/sets/sets.py
index 3c4aa86e36..72b2fa4a0a 100644
--- a/sympy/sets/sets.py
+++ b/sympy/sets/sets.py
@@ -1907,6 +1907,10 @@ def compare(self, other):
     def _eval_evalf(self, prec):
         return FiniteSet(*[elem.evalf(n=prec_to_dps(prec)) for elem in self])
 
+    def _eval_simplify(self, **kwargs):
+        from sympy.simplify import simplify
+        return FiniteSet(*[simplify(elem, **kwargs) for elem in self])
+
     @property
     def _sorted_args(self):
         return self.args


Test patch:
diff --git a/sympy/sets/tests/test_sets.py b/sympy/sets/tests/test_sets.py
index dec3b08f37..0cf7c454f5 100644
--- a/sympy/sets/tests/test_sets.py
+++ b/sympy/sets/tests/test_sets.py
@@ -1612,3 +1612,7 @@ def test_issue_20379():
     #https://github.com/sympy/sympy/issues/20379
     x = pi - 3.14159265358979
     assert FiniteSet(x).evalf(2) == FiniteSet(Float('3.23108914886517e-15', 2))
+
+def test_finiteset_simplify():
+    S = FiniteSet(1, cos(1)**2 + sin(1)**2)
+    assert S.simplify() == {1}
diff --git a/sympy/solvers/tests/test_solveset.py b/sympy/solvers/tests/test_solveset.py
index 5a2c04bfe8..f0ead92fac 100644
--- a/sympy/solvers/tests/test_solveset.py
+++ b/sympy/solvers/tests/test_solveset.py
@@ -2474,16 +2474,6 @@ def test_issue_17276():
      FiniteSet((5**(S(1)/5), 25*5**(S(3)/10)))
 
 
-def test_issue_10426():
-    x=Dummy('x')
-    a=Symbol('a')
-    n=Dummy('n')
-    assert (solveset(sin(x + a) - sin(x), a)).dummy_eq(Dummy('x')) == (Union(
-        ImageSet(Lambda(n, 2*n*pi), S.Integers),
-        Intersection(S.Complexes, ImageSet(Lambda(n, -I*(I*(2*n*pi + arg(-exp(-2*I*x))) + 2*im(x))),
-        S.Integers)))).dummy_eq(Dummy('x,n'))
-
-
 @XFAIL
 def test_substitution_with_infeasible_solution():
     a00, a01, a10, a11, l0, l1, l2, l3, m0, m1, m2, m3, m4, m5, m6, m7, c00, c01, c10, c11, p00, p01, p10, p11 = symbols(