Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the result was different in python Sympy.limit?

I guess both of them are equal(in python/sympy):

from sympy import *

x = Symbol('x')

limit(sin(x)/x,x,0)

#(result 1)

limit(sin(1/x)*x,x,00)

#(result 0 !!!)

In actually, let y = 1/x, limit(sin(1/x)*x,x,00) = limit(sin(y)/y,y,0), right?

(in anaconda 64-bit,ipython notebook, python 2.7, sympy0.7.6)

like image 217
sodis Avatar asked Oct 18 '25 05:10

sodis


2 Answers

Try to use oo (oo is infinity) instead of 00.

like image 174
bubble Avatar answered Oct 19 '25 19:10

bubble


To more exactly, use sympy.oo

import sympy as sym
from IPython.display import display,Math
fx = (1+1/x)**x
lim_pnt = sym.oo
lim = sym.limit(fx,x,lim_pnt)

display(Math('\\lim_{x\\to %s} %s = %s' %(lim_pnt,sym.latex(fx),sym.latex(lim))))
like image 39
Ray Ronnaret Avatar answered Oct 19 '25 18:10

Ray Ronnaret



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!