Comment #52 on issue 2084 by nicolas....@gmail.com: limit(1+1/x, x, 0, dir='-') fails
http://code.google.com/p/sympy/issues/detail?id=2084

Some issues mentioned by Ronan still remain:

In [1]: limit((-x)**(-1/S(2)),x,0,dir="-")
Out[1]:
-ⅈ
──
0

In [2]: gruntz((-x)**(-1/S(2)),x,0,dir="-")
Out[2]: ∞

Gruntz() is actually correct.



There are also some others:

In [3]: limit((-x)**(-1/S(2)),x,0,dir="+")
Out[3]: ∞

In [4]: gruntz((-x)**(-1/S(2)),x,0,dir="+")
Out[4]:
-ⅈ
──
0


I would rewrite code as following:

    if e.is_Pow:
        b, ex = e.args
        if b.is_Mul:
            c, b = b.as_two_terms()
            c = sign(c)
        else:
            c = S.One
        if c == S.NegativeOne:
            if dir == "+":
                dir = "-"
            else:
                dir = "+"
        if b == z and ex.is_number:
            if z0 == 0 and ex < 0:
                if dir == '-':
                    # integer
                    if ex.is_even:
                        return S.Infinity
                    elif ex.is_odd:
                        return S.NegativeInfinity
                    # rational
                    elif ex.is_Rational:
                        return (S.NegativeOne**ex)*S.Infinity
                    else:
                        return S.ComplexInfinity
                return S.Infinity
            return z0**ex


and change tests accordingly.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to