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

Fails to Solve Definite Integral #20941

Open
programizer opened this issue Feb 11, 2021 · 4 comments
Open

Fails to Solve Definite Integral #20941

programizer opened this issue Feb 11, 2021 · 4 comments

Comments

@programizer
Copy link

integrate(u**2*sqrt(1-u**2),(u,0,1))

This doesn't return a proper result in SymPy. It talks about a u>1 case, which we don't have, gives complicated expressions and doesn't plug in the limits.

Despite being SymPy syntax this exact same line works fine in WolframAlpha:
https://www.wolframalpha.com/input/?i=integrate%28u**2*sqrt%281-u**2%29%2C%28u%2C0%2C1%29%29

@ayushbisht2001
Copy link
Contributor

@programizer , you can try integrate(u**2*sqrt(1-u**2),(u,0,1)).evalf() to get the result.

skirpichev added a commit to skirpichev/diofant that referenced this issue Feb 12, 2021
@hyadav2k
Copy link
Contributor

It breaks the integrand in Piecewise equations as:

Piecewise((_Dummy_23**5*I/(4*sqrt(_Dummy_23**2 - 1)) - 3*_Dummy_23**3*I/(8*sqrt(_Dummy_23**2 - 1)) + _Dummy_23*I/(8*sqrt(_Dummy_23**2 - 1)) - I*acosh(_Dummy_23)/8, _Dummy_23**2 > 1), (-_Dummy_23**5/(4*sqrt(1 - _Dummy_23**2)) + 3*_Dummy_23**3/(8*sqrt(1 - _Dummy_23**2)) - _Dummy_23/(8*sqrt(1 - _Dummy_23**2)) + asin(_Dummy_23)/8, True))

This occurs at:

h = meijerint_indefinite(g, x)

which is called in doit at:
antideriv = self._eval_integral(
function, xab[0], **eval_kwargs)

@programizer
Copy link
Author

@ayushbisht2001 Thanks. Based on your comment, this hack would have done what I wanted:
nsimplify(integrate(u**2*sqrt(1-u**2),(u,0,1)).evalf(),[pi,E])
(which gives pi/16)
Still, I think fixing this issue would be an improvement for sympy.

@techiepriyansh
Copy link
Contributor

Surprisingly, taking the u**2 inside the sqrt gives the desired result.

>>> integrate(sqrt(u**4-u**6),(u,0,1))
pi/16

skirpichev added a commit to skirpichev/diofant that referenced this issue Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants