Not getting correct limits

24 views
Skip to first unread message

div...@umich.edu

unread,
Oct 16, 2017, 11:19:15 AM10/16/17
to sympy
The following code was run using sympy version 1.0, python version 3.4, Anaconda installation.


import sympy as spy
import sympy.abc as abc


N
, k = spy.symbols('N, k', positive = True)
es
= 1 - (1 - 1/(2*N))**k
e
= 2*N*es
spy
.pprint(e)
c0
= spy.limit(e, N, spy.oo)
spy
.pprint(c0)
c1
= spy.limit(N*(e-c0), N, spy.oo)
spy
.pprint(c1)
c2
= spy.limit((e-c0-c1/N)*(N*N), N, spy.oo)
spy
.pprint(c2)
c2x
= spy.limit(e*N*N-c0*N*N-c1*N, N, spy.oo)
spy
.pprint(c2x)


It prints
 


   
          k    
   
      1    
2N⋅⎜- 1 - ───⎟  + 1
   
     2N    
k
   
2    
  k    k
- ── +
 
4    4
-∞
 
3    2    
k    k    k
── - ── + ──
24   8    12


As you can see, the result for c2 is wrong, although it is able to calculate c2x correctly. 

Can someone please clarify what is going on?

Thanks!

Aaron Meurer

unread,
Oct 16, 2017, 1:26:13 PM10/16/17
to sy...@googlegroups.com
This looks like a bug. Can you open an issue for it?

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/8dd538f6-5487-4059-bd8c-eb1a86753af8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

div...@umich.edu

unread,
Oct 16, 2017, 2:59:48 PM10/16/17
to sympy
Sure I will. The bug is still present  in version 1.1.1 of sympy (Python 3.6).
Reply all
Reply to author
Forward
0 new messages