Wrong results for limits with sign() function

41 views
Skip to first unread message

Arnaud Usciati

unread,
Feb 15, 2015, 7:55:28 AM2/15/15
to sy...@googlegroups.com
Hello,

If x = symbols('x', real=True).

I found wrong results for limits with sign() function.
limit(sign(x), x, 0, '+') = 1, and limit(sign(x), x, 0, '-') = -1 ---> OK

But :
- limit(sign(ln(x)), x, 1, '+') = 1 (OK) but limit(sign(ln(x)), x, 1, '-') = 0 instead of -1 ;
- limit(sign(sin(x)), x, 0, '+') = 0 and limit(sign(sin(x)), x, 0, '-') = 0, instead of 1 and -1 ;
- limit(sign(tan(x)), x, 0, '+') = 0 and limit(sign(tan(x)), x, 0, '-') = 0, instead of 1 and -1 ;
- limit(sign(cos(x)), x, pi/2, '+') = 0 and limit(sign(cos(x)), x, pi/2, '-') = 0, instead of 1 and -1 ;
Etc......

KiRa2a,
(sympy.0.7.6.win32)


Sergey Kirpichev

unread,
Dec 14, 2015, 12:44:36 PM12/14/15
to sympy

Patch: https://github.com/skirpichev/omg/pull/154
(Should work for sympy with trivial replacement .is_extended_real -> .is_real)

Please note that

> limit(sign(cos(x)), x, pi/2, '+') = 0 and limit(sign(cos(x)), x, pi/2, '-') = 0, instead of 1 and -1 ;

is incorrect.  Should be -1 and 1 instead, c.f. Mathematica output:

In[3]:= Limit[Sign[Cos[x]], x->Pi/2, Direction->-1] (* default, equivalent to dir="+" *)
Out[3]=
-1
In[4]:= Limit[Sign[Cos[x]], x->Pi/2, Direction->+1]
Out[4]=
1
Reply all
Reply to author
Forward
0 new messages