Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium Evalf

New issue 4093 by [email protected]: log(x).evalf(subs={x: 0}) gives TypeError: 'NoneType' object is not iterable
http://code.google.com/p/sympy/issues/detail?id=4093

In [14]: log(x).evalf(subs={x: 0})
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-14-cffc23219cc7> in <module>()
----> 1 log(x).evalf(subs={x: 0})

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/evalf.py in evalf(self, n, subs, maxn, chop, strict, quad, verbose)
   1280             options['quad'] = quad
   1281         try:
-> 1282             result = evalf(self, prec + 4, options)
   1283         except NotImplementedError:
   1284             # Fall back to the ordinary evalf

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/evalf.py in evalf(x, prec, options)
   1180     try:
   1181         rf = evalf_table[x.func]
-> 1182         r = rf(x, prec, options)
   1183     except KeyError:
   1184         try:

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/evalf.py in evalf_log(expr, prec, options)
    775         return re[0], im, re[2], prec
    776
--> 777     imaginary_term = (mpf_cmp(xre, fzero) < 0)
    778
    779     re = mpf_log(mpf_abs(xre), prec, rnd)

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/mpmath/libmp/libmpf.py in mpf_cmp(s, t) 553 # A full subtraction is relatively slow, however, so we first try to
    554     # look at the components.
--> 555     ssign, sman, sexp, sbc = s
    556     tsign, tman, texp, tbc = t
    557

TypeError: 'NoneType' object is not iterable

The reason is that log(0) is not defined, but it should probably raise a better error, like ValueError, or return nan or something (log(0) directly returns zoo, so maybe nan wouldn't be correct, I don't know).

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to