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

Sum does not seem to simplify before using subs #11301

Open
nicoguaro opened this issue Jun 26, 2016 · 1 comment
Open

Sum does not seem to simplify before using subs #11301

nicoguaro opened this issue Jun 26, 2016 · 1 comment
Labels

Comments

@nicoguaro
Copy link
Contributor

I have an expression of the form

fun = Sum(x**(k + 4)/(k*x), (k, 0, oo))

and, when I try to substitute x for 0 I get

Sum(0**(k + 4)*zoo/k, (k, 0, oo))

I try using simplify before

simplify(fun).subs(x, 0)

I obtain the same

Sum(0**(k + 4)*zoo/k, (k, 0, oo))

But If I use expand

expand(fun).subs(x, 0)

I get

Sum(0, (k, 0, oo))

I just checked with the ratio of two polynomials

 (x**2/x).subs(x, 0)

and it returns 0. Is this a bug or is the expected behavior for summations?

@oscarbenjamin
Copy link
Contributor

Some examples are working now

In [118]: simplify(fun).subs(x, 0) 
     ...:                                                                                                                                                     
Out[118]: 0

In [119]: expand(fun).subs(x, 0)                                                                                                                              
Out[119]: 
  ∞    
 ___   
 ╲     
  ╲   0
  ╱    
 ╱     
 ‾‾‾   
k = 0  

In [120]: _.doit()                                                                                                                                            
Out[120]: 0

This one still doesn't work:

In [117]: fun.subs(x, 0)                                                                                                                                      
Out[117]: 
  ∞             
 ____           
 ╲              
  ╲    k + 4    
   ╲  0     ⋅zoo
   ╱  ──────────
  ╱       k     
 ╱              
 ‾‾‾‾           
k = 0 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants