Repository: sympy/sympy

Issue:
manualintegrate doesn't give simple integral
integral x/(1+x^4) is 1/2*atan(x^2), but manualintegrate gives DontKnowRule.


Discussion:

Patch:
diff --git a/sympy/integrals/manualintegrate.py b/sympy/integrals/manualintegrate.py
index b4bf0ece98..974fb40696 100644
--- a/sympy/integrals/manualintegrate.py
+++ b/sympy/integrals/manualintegrate.py
@@ -30,6 +30,7 @@
 from sympy.strategies.core import switch, do_one, null_safe, condition
 from sympy.core.relational import Eq, Ne
 from sympy.polys.polytools import degree
+from sympy.ntheory.factor_ import divisors
 
 ZERO = sympy.S.Zero
 
@@ -180,10 +181,18 @@ def possible_subterms(term):
                 r.extend(possible_subterms(u))
             return r
         elif isinstance(term, sympy.Pow):
+            r = []
             if term.args[1].is_constant(symbol):
-                return [term.args[0]]
+                r.append(term.args[0])
             elif term.args[0].is_constant(symbol):
-                return [term.args[1]]
+                r.append(term.args[1])
+            if term.args[1].is_Integer:
+                r.extend([term.args[0]**d for d in divisors(term.args[1])
+                    if 1 < d < abs(term.args[1])])
+                if term.args[0].is_Add:
+                    r.extend([t for t in possible_subterms(term.args[0])
+                        if t.is_Pow])
+            return r
         elif isinstance(term, sympy.Add):
             r = []
             for arg in term.args:


Test patch:
diff --git a/sympy/integrals/tests/test_manual.py b/sympy/integrals/tests/test_manual.py
index 927e1a55ce..ed30c7b539 100644
--- a/sympy/integrals/tests/test_manual.py
+++ b/sympy/integrals/tests/test_manual.py
@@ -401,3 +401,10 @@ def test_issue_9858():
         x*exp(7*x)/7 + x*exp(6*x)/6 + x*exp(5*x)/5 + x*exp(4*x)/4 +
         x*exp(3*x)/3 + x*exp(2*x)/2 + x*exp(x) - exp(7*x)/49 -exp(6*x)/36 -
         exp(5*x)/25 - exp(4*x)/16 - exp(3*x)/9 - exp(2*x)/4 - exp(x))
+
+
+def test_issue_8520():
+    assert manualintegrate(x/(x**4 + 1), x) == atan(x**2)/2
+    assert manualintegrate(x**2/(x**6 + 25), x) == atan(x**3/5)/15
+    f = x/(9*x**4 + 4)**2
+    assert manualintegrate(f, x).diff(x).factor() == f