Repository: sympy/sympy

Issue:
Interval.evalf() and FiniteSet.evalf() incorrect for Symbols
The following raises a `SympifyError: None`
```
In [1]: Interval(1, x).n()
```
and here a non-sensical `None` is returned:
```
In [2]: FiniteSet(1, x).n()
Out[2]: {None, 1.0}
```

The reason is that in `_eval_evalf` methods in `Interval` and `FiniteSet` call `_eval_evalf` on the endpoints / elements instead of the more appropriate `_evalf`.

Discussion:

Patch:
diff --git a/sympy/sets/sets.py b/sympy/sets/sets.py
index 3e5c050858..10901a8961 100644
--- a/sympy/sets/sets.py
+++ b/sympy/sets/sets.py
@@ -1098,9 +1098,8 @@ def to_mpi(self, prec=53):
             mpf(self.end._eval_evalf(prec)))
 
     def _eval_evalf(self, prec):
-        return Interval(self.left._eval_evalf(prec),
-            self.right._eval_evalf(prec),
-                        left_open=self.left_open, right_open=self.right_open)
+        return Interval(self.left._evalf(prec), self.right._evalf(prec),
+            left_open=self.left_open, right_open=self.right_open)
 
     def _is_comparable(self, other):
         is_comparable = self.start.is_comparable
@@ -1912,7 +1911,7 @@ def compare(self, other):
         return (hash(self) - hash(other))
 
     def _eval_evalf(self, prec):
-        return FiniteSet(*[elem._eval_evalf(prec) for elem in self])
+        return FiniteSet(*[elem._evalf(prec) for elem in self])
 
     @property
     def _sorted_args(self):


Test patch:
diff --git a/sympy/sets/tests/test_sets.py b/sympy/sets/tests/test_sets.py
index 6ad3090ef3..c4e6510f42 100644
--- a/sympy/sets/tests/test_sets.py
+++ b/sympy/sets/tests/test_sets.py
@@ -629,6 +629,15 @@ def test_interval_to_mpi():
     assert type(Interval(0, 1).to_mpi()) == type(mpi(0, 1))
 
 
+def test_set_evalf():
+    assert Interval(S(11)/64, S.Half).evalf() == Interval(
+        Float('0.171875'), Float('0.5'))
+    assert Interval(x, S.Half, right_open=True).evalf() == Interval(
+        x, Float('0.5'), right_open=True)
+    assert Interval(-oo, S.Half).evalf() == Interval(-oo, Float('0.5'))
+    assert FiniteSet(2, x).evalf() == FiniteSet(Float('2.0'), x)
+
+
 def test_measure():
     a = Symbol('a', real=True)