Reputation: 407
The following code
from sympy import *
r = Symbol('r', real=True, positive=True)
a = Symbol('a', real=True, positive=True)
Integral(1/r**2,(r,oo,a)).doit()
results in an error
TypeError: bad operand type for unary -: 'tuple'
whereas
-Integral(1/r**2,(r,a,oo)).doit()
, which is an equivalent formulation of the integral above, gives the correct result: -1/a
.
Furthermore, lowering the restrictions for the domain of a
r = Symbol('r', real=True, positive=True)
a = Symbol('a')
Integral(1/r**2,(r,oo,a)).doit()
gives the correct result as well.
Is this a bug in sympy
or what is going wrong here?
Edit: It is completely valid to integrate from Infinity to a positive value. Mathematica does the job right as I wrote in my comment addressed to @BenT.
Upvotes: 4
Views: 666
Reputation: 407
I can confirm that this is a bug in sympy
.
I opened an issue in their github (https://github.com/sympy/sympy/issues/13536) which will be resolved soon.
Upvotes: 2