On Apr 13, 11:45 am, Hector <hector1...@gmail.com> wrote: > Hello groups, > > This is about the way limit has been defined in sympy. Currently, Sympy > gives following result. > > In [1]: limit(abs(x)/x,x,0) > Out[1]: 1 > > But as we know, the right-hand and left-hand of limit at given function is > different. > > In [2]: limit(abs(x)/x, x, 0, dir = "+") > Out[2]: 1 > > In [3]: limit(abs(x)/x, x, 0, dir = "-") > Out[3]: -1 > > And hence mathematically speaking, limit doesn't exist at given point. Sympy > assumes dir = "+" by default and hence giving the wrong answer. The similar > type of discussions has been made some times ago in Issue1000[1]. As > suggested in discussions, the default dir should be " r " for real line > where it checks both right hand side and left hand side limit and returns > the answer iff both are equal. For this to happen, I am proposing that we > should rename current "limit" function by "limit_eval" and define new limit > function which checks both right hand limit and left hand limit. > > I made the necessary changes, and the corresponding pull request is #219[2]. > If this changing definition things is fine with core developers, I would > like to proceed further for limts of bi-variant functions. > > -- > -Regards > Hector > > Whenever you think you can or you can't, in either way you are right. > > [1]http://code.google.com/p/sympy/issues/detail?can=2&q=1000&colspec=ID%... > [2]https://github.com/sympy/sympy/pull/219
I do appreciate when sympy's functions are based as closely as possible on the mathematical definition, so I am +1 on this general idea. However: - Introducing limit_eval is repetitive. Just use limit(..., dir="+") if that is the intended behavior. - The default for the dir argument should depend on the assumptions on x. So you would get dir="r" when x is declared Symbol("x", real=True) but dir=(complex plane, I don't know the key, c?) when x is declared Symbol("x", complex=True). Regards, Julien -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.