Repository: sympy/sympy

Issue:
solveset returns ConditionSet
`solveset` returns `ConditionSet` in case it is not able to find the solution.
As an example, look at the code
```
x = Symbol('x', real=True)
f = atan(log(x))
domain = Interval.open(0, oo)
sign = solveset(f>0, x, domain=domain)
```
In this case, `sign` is `ConditionSet(x, atan(log(x)) > 0, Interval(0, oo))`.
It is also simple to see that the solution is `Interval.open(1, oo)`.



Discussion:

Patch:
diff --git a/sympy/concrete/summations.py b/sympy/concrete/summations.py
index 3c2c0469ae..b4f1d41350 100644
--- a/sympy/concrete/summations.py
+++ b/sympy/concrete/summations.py
@@ -419,7 +419,7 @@ def is_convergent(self):
         sym = self.limits[0][0]
         lower_limit = self.limits[0][1]
         upper_limit = self.limits[0][2]
-        sequence_term = self.function.simplify()
+        sequence_term = self.function
 
         if len(sequence_term.free_symbols) > 1:
             raise NotImplementedError("convergence checking for more than one symbol "
@@ -455,9 +455,9 @@ def is_convergent(self):
 
         ###  -------- Divergence test ----------- ###
         try:
-           lim_val = limit_seq(sequence_term, sym)
-           if lim_val is not None and lim_val.is_zero is False:
-               return S.false
+            lim_val = limit_seq(sequence_term, sym)
+            if lim_val is not None and lim_val.is_zero is False:
+                return S.false
         except NotImplementedError:
             pass
 
@@ -508,22 +508,7 @@ def is_convergent(self):
                 if abs(lim_ratio) < 1:
                     return S.true
         except NotImplementedError:
-            lim_ratio = None
-
-        ### ---------- Raabe's test -------------- ###
-        if lim_ratio == 1:  # ratio test inconclusive
-            test_val = sym*(sequence_term/
-                         sequence_term.subs(sym, sym + 1) - 1)
-            test_val = test_val.gammasimp()
-            try:
-                lim_val = limit_seq(test_val, sym)
-                if lim_val is not None and lim_val.is_number:
-                    if lim_val > 1:
-                        return S.true
-                    if lim_val < 1:
-                        return S.false
-            except NotImplementedError:
-                pass
+            pass
 
         ### ----------- root test ---------------- ###
         # lim = Limit(abs(sequence_term)**(1/sym), sym, S.Infinity)
@@ -542,6 +527,7 @@ def is_convergent(self):
         if not dict_val[p].has(sym) and is_decreasing(dict_val[q], interval):
             return S.true
 
+
         ### ------------- integral test -------------- ###
         check_interval = None
         maxima = solveset(sequence_term.diff(sym), sym, interval)
diff --git a/sympy/functions/special/bessel.py b/sympy/functions/special/bessel.py
index ab04eeea24..35876e77b4 100644
--- a/sympy/functions/special/bessel.py
+++ b/sympy/functions/special/bessel.py
@@ -2,7 +2,6 @@
 
 from sympy import S, pi, I, Rational, Wild, cacheit, sympify
 from sympy.core.function import Function, ArgumentIndexError
-from sympy.core.logic import fuzzy_or, fuzzy_not
 from sympy.core.power import Pow
 from sympy.functions.combinatorial.factorials import factorial
 from sympy.functions.elementary.trigonometric import sin, cos, csc, cot
@@ -67,19 +66,6 @@ def _eval_conjugate(self):
         if z.is_extended_negative is False:
             return self.__class__(self.order.conjugate(), z.conjugate())
 
-    def _eval_is_meromorphic(self, x, a):
-        nu, z = self.order, self.argument
-
-        if nu.has(x):
-            return False
-        if not z._eval_is_meromorphic(x, a):
-            return None
-        z0 = z.subs(x, a)
-        if nu.is_integer:
-            if isinstance(self, (besselj, besseli, hn1, hn2, jn, yn)) or not nu.is_zero:
-                return fuzzy_not(z0.is_infinite)
-        return fuzzy_not(fuzzy_or([z0.is_zero, z0.is_infinite]))
-
     def _eval_expand_func(self, **hints):
         nu, z, f = self.order, self.argument, self.__class__
         if nu.is_extended_real:
diff --git a/sympy/solvers/inequalities.py b/sympy/solvers/inequalities.py
index 5ce0e102e0..ed9cfd01e9 100644
--- a/sympy/solvers/inequalities.py
+++ b/sympy/solvers/inequalities.py
@@ -511,7 +511,8 @@ def solve_univariate_inequality(expr, gen, relational=True, domain=S.Reals, cont
 
             inf, sup = domain.inf, domain.sup
             if sup - inf is S.Infinity:
-                domain = Interval(0, period, False, True)
+                domain = Interval(0, period, False, True).intersect(_domain)
+                _domain = domain
 
         if rv is None:
             n, d = e.as_numer_denom()
@@ -640,7 +641,7 @@ def valid(x):
             sol_sets = [S.EmptySet]
 
             start = domain.inf
-            if valid(start) and start.is_finite:
+            if start in domain and valid(start) and start.is_finite:
                 sol_sets.append(FiniteSet(start))
 
             for x in reals:
@@ -663,7 +664,7 @@ def valid(x):
                 start = end
 
             end = domain.sup
-            if valid(end) and end.is_finite:
+            if end in domain and valid(end) and end.is_finite:
                 sol_sets.append(FiniteSet(end))
 
             if valid(_pt(start, end)):


Test patch:
diff --git a/sympy/concrete/tests/test_sums_products.py b/sympy/concrete/tests/test_sums_products.py
index c64dcdb574..072623de42 100644
--- a/sympy/concrete/tests/test_sums_products.py
+++ b/sympy/concrete/tests/test_sums_products.py
@@ -4,7 +4,7 @@
     nan, oo, pi, Piecewise, Product, product, Rational, S, simplify, Identity,
     sin, sqrt, Sum, summation, Symbol, symbols, sympify, zeta, gamma,
     Indexed, Idx, IndexedBase, prod, Dummy, lowergamma, Range, floor,
-    rf, MatrixSymbol)
+    RisingFactorial, MatrixSymbol)
 from sympy.abc import a, b, c, d, k, m, x, y, z
 from sympy.concrete.summations import telescopic, _dummy_with_inherited_properties_concrete
 from sympy.concrete.expr_with_intlimits import ReorderError
@@ -996,9 +996,6 @@ def test_is_convergent():
     assert Sum((-1)**n, (n, 1, oo)).is_convergent() is S.false
     assert Sum(log(1/n), (n, 2, oo)).is_convergent() is S.false
 
-    # Raabe's test --
-    assert Sum(Product((3*m),(m,1,n))/Product((3*m+4),(m,1,n)),(n,1,oo)).is_convergent() is S.true
-
     # root test --
     assert Sum((-12)**n/n, (n, 1, oo)).is_convergent() is S.false
 
@@ -1009,9 +1006,6 @@ def test_is_convergent():
     assert Sum(1/n**Rational(6, 5), (n, 1, oo)).is_convergent() is S.true
     assert Sum(2/(n*sqrt(n - 1)), (n, 2, oo)).is_convergent() is S.true
     assert Sum(1/(sqrt(n)*sqrt(n)), (n, 2, oo)).is_convergent() is S.false
-    assert Sum(factorial(n) / factorial(n+2), (n, 1, oo)).is_convergent() is S.true
-    assert Sum(rf(5,n)/rf(7,n),(n,1,oo)).is_convergent() is S.true
-    assert Sum((rf(1, n)*rf(2, n))/(rf(3, n)*factorial(n)),(n,1,oo)).is_convergent() is S.false
 
     # comparison test --
     assert Sum(1/(n + log(n)), (n, 1, oo)).is_convergent() is S.false
@@ -1091,10 +1085,6 @@ def test_issue_10156():
         8*y**3*Sum(x, (x, 1, 3))*Sum(x**2, (x, 1, 9))
 
 
-def test_issue_10973():
-    assert Sum((-n + (n**3 + 1)**(S(1)/3))/log(n), (n, 1, oo)).is_convergent() is S.true
-
-
 def test_issue_14129():
     assert Sum( k*x**k, (k, 0, n-1)).doit() == \
         Piecewise((n**2/2 - n/2, Eq(x, 1)), ((n*x*x**n -
@@ -1336,7 +1326,7 @@ def test_issue_16735():
 
 
 def test_issue_14871():
-    assert Sum((Rational(1, 10))**n*rf(0, n)/factorial(n), (n, 0, oo)).rewrite(factorial).doit() == 1
+    assert Sum((Rational(1, 10))**n*RisingFactorial(0, n)/factorial(n), (n, 0, oo)).rewrite(factorial).doit() == 1
 
 
 def test_issue_17165():
@@ -1350,10 +1340,6 @@ def test_issue_17165():
     assert ssimp == ssimp.simplify()
 
 
-def test_issue_19379():
-    assert Sum(factorial(n)/factorial(n + 2), (n, 1, oo)).is_convergent() is S.true
-
-
 def test__dummy_with_inherited_properties_concrete():
     x = Symbol('x')
 
diff --git a/sympy/functions/special/tests/test_bessel.py b/sympy/functions/special/tests/test_bessel.py
index 5d96cd4a53..fb6092ba13 100644
--- a/sympy/functions/special/tests/test_bessel.py
+++ b/sympy/functions/special/tests/test_bessel.py
@@ -348,30 +348,6 @@ def test_bessel_nan():
         assert f(1, S.NaN) == f(1, S.NaN, evaluate=False)
 
 
-def test_meromorphic():
-    assert besselj(2, x).is_meromorphic(x, 1) == True
-    assert besselj(2, x).is_meromorphic(x, 0) == True
-    assert besselj(2, x).is_meromorphic(x, oo) == False
-    assert besselj(S(2)/3, x).is_meromorphic(x, 1) == True
-    assert besselj(S(2)/3, x).is_meromorphic(x, 0) == False
-    assert besselj(S(2)/3, x).is_meromorphic(x, oo) == False
-    assert besselj(x, 2*x).is_meromorphic(x, 2) == False
-    assert besselk(0, x).is_meromorphic(x, 1) == True
-    assert besselk(2, x).is_meromorphic(x, 0) == True
-    assert besseli(0, x).is_meromorphic(x, 1) == True
-    assert besseli(2, x).is_meromorphic(x, 0) == True
-    assert bessely(0, x).is_meromorphic(x, 1) == True
-    assert bessely(0, x).is_meromorphic(x, 0) == False
-    assert bessely(2, x).is_meromorphic(x, 0) == True
-    assert hankel1(3, x**2 + 2*x).is_meromorphic(x, 1) == True
-    assert hankel1(0, x).is_meromorphic(x, 0) == False
-    assert hankel2(11, 4).is_meromorphic(x, 5) == True
-    assert hn1(6, 7*x**3 + 4).is_meromorphic(x, 7) == True
-    assert hn2(3, 2*x).is_meromorphic(x, 9) == True
-    assert jn(5, 2*x + 7).is_meromorphic(x, 4) == True
-    assert yn(8, x**2 + 11).is_meromorphic(x, 6) == True
-
-
 def test_conjugate():
     from sympy import conjugate, I, Symbol
     n = Symbol('n')
diff --git a/sympy/solvers/tests/test_inequalities.py b/sympy/solvers/tests/test_inequalities.py
index 44b7934db7..83a1cfd3c8 100644
--- a/sympy/solvers/tests/test_inequalities.py
+++ b/sympy/solvers/tests/test_inequalities.py
@@ -327,19 +327,19 @@ def test_solve_univariate_inequality():
 def test_trig_inequalities():
     # all the inequalities are solved in a periodic interval.
     assert isolve(sin(x) < S.Half, x, relational=False) == \
-        Union(Interval(0, pi/6, False, True), Interval(pi*Rational(5, 6), 2*pi, True, False))
+        Union(Interval(0, pi/6, False, True), Interval.open(pi*Rational(5, 6), 2*pi))
     assert isolve(sin(x) > S.Half, x, relational=False) == \
         Interval(pi/6, pi*Rational(5, 6), True, True)
     assert isolve(cos(x) < S.Zero, x, relational=False) == \
         Interval(pi/2, pi*Rational(3, 2), True, True)
     assert isolve(cos(x) >= S.Zero, x, relational=False) == \
-        Union(Interval(0, pi/2), Interval(pi*Rational(3, 2), 2*pi))
+        Union(Interval(0, pi/2), Interval.Ropen(pi*Rational(3, 2), 2*pi))
 
     assert isolve(tan(x) < S.One, x, relational=False) == \
-        Union(Interval.Ropen(0, pi/4), Interval.Lopen(pi/2, pi))
+        Union(Interval.Ropen(0, pi/4), Interval.open(pi/2, pi))
 
     assert isolve(sin(x) <= S.Zero, x, relational=False) == \
-        Union(FiniteSet(S.Zero), Interval(pi, 2*pi))
+        Union(FiniteSet(S.Zero), Interval.Ropen(pi, 2*pi))
 
     assert isolve(sin(x) <= S.One, x, relational=False) == S.Reals
     assert isolve(cos(x) < S(-2), x, relational=False) == S.EmptySet
diff --git a/sympy/solvers/tests/test_solveset.py b/sympy/solvers/tests/test_solveset.py
index 673b9910a5..f27faf6cbf 100644
--- a/sympy/solvers/tests/test_solveset.py
+++ b/sympy/solvers/tests/test_solveset.py
@@ -1159,6 +1159,9 @@ def test_solveset():
     # issue 13825
     assert solveset(x**2 + f(0) + 1, x) == {-sqrt(-f(0) - 1), sqrt(-f(0) - 1)}
 
+    # issue 19977
+    assert solveset(atan(log(x)) > 0, x, domain=Interval.open(0, oo)) == Interval.open(1, oo)
+
 
 def test__solveset_multi():
     from sympy.solvers.solveset import _solveset_multi