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
Bug in integration solver #21721
Comments
If In [8]: a = Symbol('a', real=True)
In [9]: integrate(1/(pi*(1+(x-a)**2)),(x,-oo,oo))
Out[9]: 1 |
Thank you so much :) |
Reopening because the answer should not be given as zero when |
Seems to be a bug in the limit code: In [1]: a = Symbol('a')
In [2]: I = integrate(1/(pi*(1+(x-a)**2)),x)
In [3]: I
Out[3]:
ⅈ⋅log(-a + x - ⅈ) ⅈ⋅log(-a + x + ⅈ)
- ───────────────── + ─────────────────
2 2
───────────────────────────────────────
π
In [4]: I.limit(x, oo)
Out[4]: 0
In [5]: I.limit(x, -oo) # <-- should be -1
Out[5]: 0 Seems to be also a bug for this limit (even though the integral works in this case): In [9]: a = Symbol('a', real=True)
In [10]: I = integrate(1/(pi*(1+(x-a)**2)),x)
In [11]: I
Out[11]:
-atan(a - x)
─────────────
π
In [12]: I.limit(x, oo) # <-- should be +1/2
Out[12]: -1/2
In [13]: I.limit(x, -oo)
Out[13]: -1/2 |
Actually this is a regression on master since sympy 1.8. Bisected to 2b6b233 from #21589 |
I get these results also on sympy-1.8. It looks like that would be correct if |
EDIT: I see that actually you were referring to the example without real=True. |
The limit regression has been fixed in #21731, although the answer is still returned as 0 when |
Some of the problems mentioned above are fixed but some remain. The part that was identified as a regression has been fixed: In [28]: a = Symbol('a', real=True)
In [29]: I = integrate(1/(pi*(1+(x-a)**2)),x)
In [30]: I.limit(x, oo) # <-- should be +1/2
Out[30]: 1/2 I'm removing the 1.9 milestone. |
For calculating the integration of pdf of cauchy distribution I tried sympy, but it produced wrong result.
integrate(1/(pi*(1+(x-a)**2)),(x,-oo,oo))
the expected output was 1 but it produced output 0 which is wrong.
The text was updated successfully, but these errors were encountered: