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

New issue 2001 by asmeurer: log(1, 1) RuntimeError: maximum recursion depth exceeded
http://code.google.com/p/sympy/issues/detail?id=2001

In [8]: log(1, 1)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

/Users/aaronmeurer/Documents/python/sympy/sympy/<ipython console> in <module>()

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/multidimensional.pyc in wrapper(*args, **kwargs) 133 result = apply_on_element(wrapper, args, kwargs, n)
    134                     return result
--> 135             return f(*args, **kwargs)
    136         wrapper.__doc__ = f.__doc__
    137         wrapper.__name__ = f.__name__

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     83         except KeyError:
     84             pass
---> 85         func_cache_it_cache[k] = r = func(*args, **kw_args)
     86         return r
     87

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/function.pyc in __new__(cls, *args, **options)
    210         #     UC: Function('f')(x)

    211         #     UC: sin(x)

--> 212         return Application.__new__(cls, *args, **options)
    213
    214

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/multidimensional.pyc in wrapper(*args, **kwargs) 133 result = apply_on_element(wrapper, args, kwargs, n)
    134                     return result
--> 135             return f(*args, **kwargs)
    136         wrapper.__doc__ = f.__doc__
    137         wrapper.__name__ = f.__name__

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     83         except KeyError:
     84             pass
---> 85         func_cache_it_cache[k] = r = func(*args, **kw_args)
     86         return r
     87

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/function.pyc in __new__(cls, *args, **options)
    108         if options.get('evaluate') is False:
109 return super(Application, cls).__new__(cls, *args, **options)
--> 110         evaluated = cls.eval(*args)
    111         if evaluated is not None:
    112             return evaluated

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/functions/elementary/exponential.pyc in eval(cls, arg, base)
    278                 base = int(base)
    279                 arg = int(arg)
--> 280                 n = multiplicity(base, arg)
    281                 return S(n) + log(arg // base ** n) / log(base)
    282             if base is not S.Exp1:

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/ntheory/factor_.pyc in multiplicity(p, n)
     68                         n = nnew
     69                         continue
---> 70                 return m + multiplicity(p, n)
     71         n, rem = divmod(n, p)
     72     return m

...

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/ntheory/factor_.pyc in multiplicity(p, n)
     68                         n = nnew
     69                         continue
---> 70                 return m + multiplicity(p, n)
     71         n, rem = divmod(n, p)
     72     return m

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/ntheory/factor_.pyc in multiplicity(p, n)
     68                         n = nnew
     69                         continue
---> 70                 return m + multiplicity(p, n)
     71         n, rem = divmod(n, p)
     72     return m

RuntimeError: maximum recursion depth exceeded

(I think) it should return nan.  That's what similar things do:

In [9]: log(0, 1)
Out[9]: -∞

In [10]: log(1, 0)
Out[10]: 0

In [11]: log(0, 0)
Out[11]: nan

Or else, restrict the second argument to be positive and not equal to 1. I haven't taken complex analysis yet though, so I don't know how these things really play out with complex logarithms.

Here's what Maple does:

log[2](8);
                                      3
log[1](1);
Error, (in log[1]) numeric exception: division by zero
log[0](0);
Error, (in ln) numeric exception: division by zero
log[1](0);
Error, (in ln) numeric exception: division by zero
log[0](1);
Error, (in ln) numeric exception: division by zero


--
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