Skip to content

Commit

Permalink
25786 fix substitution
Browse files Browse the repository at this point in the history
  • Loading branch information
maliesen committed Feb 4, 2024
1 parent d447356 commit 352587a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions sympy/integrals/meijerint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1706,8 +1706,8 @@ def _meijerint_indefinite_1(f, x):
c += s

# we do a substitution t=a*x**b, get integrand fac*t**rho*g
fac_ = fac * C / (b*a**((1 + c)/b))
rho = (c + 1)/b - 1
fac_ = fac * C * x**(1 + c) / b
rho = (c + 1)/b

# we now use t**rho*G(params, t) = G(params + rho, t)
# [L, page 150, equation (4)]
Expand All @@ -1720,13 +1720,13 @@ def _meijerint_indefinite_1(f, x):
t = _dummy('t', 'meijerint-indefinite', S.One)

def tr(p):
return [a + rho + 1 for a in p]
return [a + rho for a in p]
if any(b.is_integer and (b <= 0) == True for b in tr(g.bm)):
r = -meijerg(
tr(g.an), tr(g.aother) + [1], tr(g.bm) + [0], tr(g.bother), t)
list(g.an), list(g.aother) + [1-rho], list(g.bm) + [-rho], list(g.bother), t)
else:
r = meijerg(
tr(g.an) + [1], tr(g.aother), tr(g.bm), tr(g.bother) + [0], t)
list(g.an) + [1-rho], list(g.aother), list(g.bm), list(g.bother) + [-rho], t)
# The antiderivative is most often expected to be defined
# in the neighborhood of x = 0.
if b.is_extended_nonnegative and not f.subs(x, 0).has(S.NaN, S.ComplexInfinity):
Expand Down
7 changes: 6 additions & 1 deletion sympy/integrals/tests/test_meijerint.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,10 +755,15 @@ def test_issue_6462():

def test_indefinite_1_bug():
assert integrate((b + t)**(-a), t, meijerg=True
) == -b**(1 - a)*(1 + t/b)**(1 - a)/(a - 1)
).equals(-b**(1 - a)*(1 + t/b)**(1 - a)/(a - 1))


def test_pr_23583():
# This result is wrong. Check whether new result is correct when this test fail.
assert integrate(1/sqrt((x - I)**2-1), meijerg=True) == \
Piecewise((acosh(x - I), Abs((x - I)**2) > 1), (-I*asin(x - I), True))


# 25786
def test_integrate_function_of_square_over_negatives():
assert integrate(exp(-x**2), (x,-5,0), meijerg=True) == sqrt(pi)/2 * erf(5)

0 comments on commit 352587a

Please sign in to comment.