Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #2850 solved. Integration doesn't halt now. #2976

Merged
merged 5 commits into from
Mar 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sympy/integrals/manualintegrate.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -336,14 +336,14 @@ def pull_out_u_rl(integrand):


return pull_out_u_rl return pull_out_u_rl


liate_rules = [pull_out_u(sympy.log), pull_out_u(sympy.atan), liate_rules = [pull_out_u(sympy.log), pull_out_u(sympy.atan, sympy.asin, sympy.acos),
pull_out_polys, pull_out_u(sympy.sin, sympy.cos), pull_out_polys, pull_out_u(sympy.sin, sympy.cos),
pull_out_u(sympy.exp)] pull_out_u(sympy.exp)]




dummy = sympy.Dummy("temporary") dummy = sympy.Dummy("temporary")
# we can integrate log(x) and atan(x) by setting dv = 1 # we can integrate log(x) and atan(x) by setting dv = 1
if isinstance(integrand, sympy.log) or isinstance(integrand, sympy.atan): if isinstance(integrand, (sympy.log, sympy.atan, sympy.asin, sympy.acos)):
integrand = dummy * integrand integrand = dummy * integrand


for index, rule in enumerate(liate_rules): for index, rule in enumerate(liate_rules):
Expand Down Expand Up @@ -766,7 +766,7 @@ def key(integral):
return sympy.Number return sympy.Number
else: else:
for cls in (sympy.Pow, sympy.Symbol, sympy.exp, sympy.log, for cls in (sympy.Pow, sympy.Symbol, sympy.exp, sympy.log,
sympy.Add, sympy.Mul, sympy.atan): sympy.Add, sympy.Mul, sympy.atan, sympy.asin, sympy.acos):
if isinstance(integrand, cls): if isinstance(integrand, cls):
return cls return cls


Expand All @@ -791,7 +791,7 @@ def _integral_is_subclass(integral):
alternatives( alternatives(
substitution_rule, substitution_rule,
condition( condition(
integral_is_subclass(sympy.Mul, sympy.log, sympy.atan), integral_is_subclass(sympy.Mul, sympy.log, sympy.atan, sympy.asin, sympy.acos),
parts_rule), parts_rule),
condition( condition(
integral_is_subclass(sympy.Mul, sympy.Pow), integral_is_subclass(sympy.Mul, sympy.Pow),
Expand Down
10 changes: 9 additions & 1 deletion sympy/integrals/tests/test_manual.py
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
from sympy import (sin, cos, tan, sec, csc, cot, log, exp, atan, from sympy import (sin, cos, tan, sec, csc, cot, log, exp, atan, asin, acos,
Symbol, Mul, Integral, integrate, pi, Dummy, Symbol, Mul, Integral, integrate, pi, Dummy,
Derivative, diff, I, sqrt, erf, Piecewise, Derivative, diff, I, sqrt, erf, Piecewise,
Eq, Ne, Q, assuming, symbols, And) Eq, Ne, Q, assuming, symbols, And)
Expand Down Expand Up @@ -149,3 +149,11 @@ def test_issue_3647():
with assuming(Q.negative(a)): with assuming(Q.negative(a)):
assert manualintegrate(1 / (a + b*x**2), x) == \ assert manualintegrate(1 / (a + b*x**2), x) == \
Integral(1/(a + b*x**2), x) Integral(1/(a + b*x**2), x)

def test_gh_issue_2850():
assert manualintegrate(asin(x)*log(x), x) == -x*asin(x) - sqrt(-x**2 + 1) \
+ (x*asin(x) + sqrt(-x**2 + 1))*log(x) - Integral(sqrt(-x**2 + 1)/x, x)
assert manualintegrate(acos(x)*log(x), x) == -x*acos(x) + sqrt(-x**2 + 1) + \
(x*acos(x) - sqrt(-x**2 + 1))*log(x) + Integral(sqrt(-x**2 + 1)/x, x)
assert manualintegrate(atan(x)*log(x), x) == -x*atan(x) + (x*atan(x) - \
log(x**2 + 1)/2)*log(x) + log(x**2 + 1)/2 + Integral(log(x**2 + 1)/x, x)/2