Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-Medium Series

New issue 2670 by asmeurer: In [65]: a Out[65]: ⎛ 2⎞ r⋅cos(θ) + ⅈ⋅r⋅sin(θ) + O⎝r ⎠ In [66]: limit(a/(r*(cos(theta) + I*sin(theta))), r, 0) Out[66]: O(1)
http://code.google.com/p/sympy/issues/detail?id=2670

In [65]: a
Out[65]:
                         ⎛ 2⎞
r⋅cos(θ) + ⅈ⋅r⋅sin(θ) + O⎝r ⎠

In [66]: limit(a/(r*(cos(theta) + I*sin(theta))), r, 0)
Out[66]: O(1)

r and theta are real. The answer should be 1. You get this is you expand the result first.

In [74]: limit(expand(a/(r*(cos(theta) + I*sin(theta)))), r, 0).simplify()
Out[74]: 1

Also, a similar limit doesn't work at all unless it is expanded

In [75]: limit((x + O(x**2))/x, x, 0)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/<ipython-input-75-627d8140a49e> in <module>()
----> 1 limit((x + O(x**2))/x, x, 0)

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/series/limits.pyc in limit(e, z, z0, dir)
    190
    191     try:
--> 192         r = gruntz(e, z, z0, dir)
    193         if r is S.NaN:
    194             raise PoleError()

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/series/gruntz.pyc in gruntz(e, z, z0, dir)
    686         else:
    687             raise NotImplementedError("dir must be '+' or '-'")
--> 688         r = limitinf(e0, z)
    689
690 # This is a bit of a heuristic for nice results... we always rewrite


/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     99         except KeyError:
    100             pass
--> 101         func_cache_it_cache[k] = r = func(*args, **kw_args)
    102         return r
    103     return wrapper

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/series/gruntz.pyc in limitinf(e, x)
    478         e = e.subs(x, p)
    479         x = p
--> 480     c0, e0 = mrv_leadterm(e, x)
    481     sig = sign(e0, x)
    482     if sig == 1:

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     99         except KeyError:
    100             pass
--> 101         func_cache_it_cache[k] = r = func(*args, **kw_args)
    102         return r
    103     return wrapper

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/series/gruntz.pyc in mrv_leadterm(e, x)
    536         return (e, S.Zero)
    537     if Omega == SubsSet():
--> 538         Omega, exps = mrv(e, x)
    539     if not Omega:
    540         # e really does not depend on x after simplification


/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/series/gruntz.pyc in mrv(e, x)
    365                                   " not implemented yet.")
    366         return mrv(e.args[0], x)
--> 367 raise NotImplementedError("Don't know how to calculate the mrv of '%s'" % e)
    368
    369 def mrv_max3(f, expsf, g, expsg, union, expsboth, x):

NotImplementedError: Don't know how to calculate the mrv of 'O(1/_p)'

In [76]: limit(expand((x + O(x**2))/x), x, 0)

I'm not sure if I should mark this is WrongResult. Is O(1) wrong? I think it's technically correct, but of course not what we want.

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

Reply via email to