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

New issue 1743 by asmeurer: Vectorize subs and make a dummy function for it
http://code.google.com/p/sympy/issues/detail?id=1743

The following should work:

In [8]: s = x*pi

In [9]: s.subs(x, range(10))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

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

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in  
subs(self, *args)
    1079         elif len(args) == 2:
    1080             old, new = args
-> 1081             return self._subs_old_new(old, new)
    1082         else:
    1083             raise TypeError("subs accepts either 1 or 2 arguments")

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/cache.pyc in  
wrapper(*args, **kw_args)
      80             k = args
      81         try:
---> 82             return func_cache_it_cache[k]
      83         except KeyError:
      84             pass

TypeError: unhashable type: 'list'

It is easy to vectorize a function, just add the decorator to the top of  
the function def, like with expand().

Also, do you think we should have a dummy function subs() that calls the  
subs method, like we do with N() for
evalf?

In [10]: subs(s, {x:12})
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

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

NameError: name 'subs' is not defined

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--

You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-iss...@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