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

Simplification bug on alternating series. #10195

Closed
decimad opened this Issue Dec 4, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@decimad
Copy link

decimad commented Dec 4, 2015

Hi!

from sympy import *
n = Symbol('n', odd=true, nonzero=true)
x = (-1)**(n/2 - Rational(1,2)) - (-1)**(3*n/2 - Rational(1,2))
print( x.subs(n,1)) # 2
print( x.subs(n,3)) # -2
print( x.subs(n,5)) # 2
print(simplify(x)) # -> 2 bug

I think this should be considered a bug.

skirpichev added a commit to diofant/diofant that referenced this issue Dec 5, 2015

Stop brave "simplifications" of complex powers with neg bases
I don't understand this huge mess (i.e. powsimp) in details,
but this simple fix prevents a "simplification" like

    In [1]: powsimp((-1)**(Symbol('n', odd=True)/2))
    Out[1]: I

No action is ok here, but better would be I**n (like Mathematica).

Fixes #143
Fixes sympy/sympy#10195

gxyd pushed a commit to gxyd/sympy that referenced this issue Jan 10, 2016

Gaurav Dhingra
changes fix issue sympy#10195
I am not sure if this is the best fix but these changes seem to fix it.

gxyd pushed a commit to gxyd/sympy that referenced this issue Jan 10, 2016

Gaurav Dhingra
fixes sympy#10195
I am not sure if this is the best fix but these changes seem to fix it.

gxyd pushed a commit to gxyd/sympy that referenced this issue Jan 10, 2016

Gaurav Dhingra
fixes sympy#10195
I am not sure if this is the best fix but these changes seem to fix it.
fixes sympy#10195

tests for fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment