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

InvalidComparison error from integrate #17473

Closed
oscarbenjamin opened this issue Aug 21, 2019 · 3 comments · Fixed by #17343 or #17489
Closed

InvalidComparison error from integrate #17473

oscarbenjamin opened this issue Aug 21, 2019 · 3 comments · Fixed by #17343 or #17489
Labels
Easy to Fix This is a good issue for new contributors. Feel free to work on this if no one else has already. integrals
Milestone

Comments

@oscarbenjamin
Copy link
Contributor

From the mailing list:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/sympy/fpRIf9c79zw/xYhYha8cDgAJ

 integrate(sin(x**n),x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\SymPyWorkbook\lib\site-packages\sympy\integrals\integrals.py", line 1477, in integrate
    return integral.doit(**doit_flags)
  File "C:\SymPyWorkbook\lib\site-packages\sympy\integrals\integrals.py", line 541, in doit
    function, xab[0], **eval_kwargs)
  File "C:\SymPyWorkbook\lib\site-packages\sympy\integrals\integrals.py", line 1012, in _eval_integral
    h = meijerint_indefinite(g, x)
  File "C:\SymPyWorkbook\lib\site-packages\sympy\integrals\meijerint.py", line 1621, in meijerint_indefinite
    res = _meijerint_indefinite_1(f.subs(x, x + a), x)
  File "C:\SymPyWorkbook\lib\site-packages\sympy\integrals\meijerint.py", line 1684, in _meijerint_indefinite_1
    if b < 0 or f.subs(x, 0).has(nan, zoo):
  File "C:\SymPyWorkbook\lib\site-packages\sympy\core\relational.py", line 304, in __nonzero__
    raise TypeError("cannot determine truth value of Relational")
TypeError: cannot determine truth value of Relational

David: I suppose I expected it to return an unevaluated integral - integral(sin(x**n),x)

@jksuom:

We should have, for example, `if (b < 0) == True or ...` here
  File "C:\SymPyWorkbook\lib\site-packages\sympy\integrals\meijerint.py", line 1684, in _meijerint_indefinite_1
    if b < 0 or f.subs(x, 0).has(nan, zoo):
@oscargus oscargus added the Easy to Fix This is a good issue for new contributors. Feel free to work on this if no one else has already. label Aug 21, 2019
@oscargus
Copy link
Contributor

I guess b.is_negative is also an alternative?

@jksuom
Copy link
Member

jksuom commented Aug 21, 2019

I think that b would be a number in typical cases. b.is_negative would then work as well though it would take a little more time.

@oscargus
Copy link
Contributor

I thought I recognized the code...

This is already fixed (but not merged) in #17343.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy to Fix This is a good issue for new contributors. Feel free to work on this if no one else has already. integrals
Projects
None yet
3 participants