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

meijerint picks wrong branch for computing indefinite integrals of algebraic functions #22126

Open
sylee957 opened this issue Sep 19, 2021 · 2 comments
Labels
integrals Wrong Result The output produced by SymPy is mathematically incorrect.

Comments

@sylee957
Copy link
Member

from sympy import *

f = x**-3 * (1 + x**4)**-Rational(1, 2)
F = integrate(f, x, meijerg=True)
print(F)

gives the result -sqrt(1 + x**(-4))/2 which does not equal to the integrand when differentiated

print(F.diff(x).xreplace({x: I}))
print(f.xreplace({x: I}))
-sqrt(2)*I/2
sqrt(2)*I/2
@sylee957 sylee957 added Wrong Result The output produced by SymPy is mathematically incorrect. integrals labels Sep 19, 2021
@sylee957 sylee957 changed the title meijerint picks wrong branch for computing indefinite integration of algebraic functions meijerint picks wrong branch for computing indefinite integrals of algebraic functions Sep 19, 2021
@Nbede
Copy link

Nbede commented Sep 21, 2021

Do you mean diff of integral should work even with complex numbers?
There's no issue with real numbers. After diff, it took out x^4 from inside the sqrt as x^2. for the complex number "I," hence there are two different answers as sqrt(i^4) is 1 and i^2 is -1.

@sylee957
Copy link
Member Author

It should be because there is a correct closed-form solution that works for all the complex numbers.
-sqrt(1 + x**4)/2/x**2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrals Wrong Result The output produced by SymPy is mathematically incorrect.
Projects
None yet
Development

No branches or pull requests

2 participants