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
wrong result integrating sin(a*(x+pi))**2 #26566
Comments
The sign issue is already fixed on master. I bisected the fix to 352587a from gh-26173. There are other problems though. The definite integral should not have In [16]: i1 = integrate(sin(a*(x+pi))**2, (x, -pi, -pi/2))
In [17]: i2 = + pi/4 - sin(pi*x)/(4*x)
In [18]: i1
Out[18]:
π sin(π⋅x)
─ - ────────
4 4⋅x
In [19]: i2
Out[19]:
π sin(π⋅x)
─ - ────────
4 4⋅x
In [20]: i1 == i2
Out[20]: False
In [21]: srepr(i1)
Out[21]: "Add(Mul(Rational(1, 4), pi), Mul(Integer(-1), Rational(1, 4), Pow(Symbol('x', real=True, positive=True), Integer(-1)), sin(Mul(pi, Symbol('x', real=True, positive=True)))))"
In [22]: srepr(i2)
Out[22]: "Add(Mul(Rational(1, 4), pi), Mul(Integer(-1), Rational(1, 4), Pow(Symbol('x', real=True), Integer(-1)), sin(Mul(pi, Symbol('x', real=True)))))" The result returned from |
the
|
Oh, of course. In that case this is fixed on master by the commit I referred above: In [1]: from sympy import *
...: x = symbols('x', real=True)
...: a = symbols('a', real=True, positive=True)
...: integrate(sin(a*(x+pi))**2, (x, -pi, -pi/2))
Out[1]:
π sin(π⋅a)
─ - ────────
4 4⋅a This issue can be closed if a test is added for this case. |
@oscarbenjamin sir this test is okay in test_integrals.py |
The test looks fine to me |
Hi,
I am using sympy version 1.12 and like some other people here, I encountered a wrong sign in a definite integral
from sympy import *
x = symbols('x', real=True)
a = symbols('x', real=True, positive=True)
integrate(sin(a*(x+pi))**2, (x, -pi, -pi/2))
it returns the result
-pi/4 + sin(pi*x)/(4*x)
which has the wrong sign.
The text was updated successfully, but these errors were encountered: