By the way, a list comprehension is a little easier to read, and also to wrap your mind around. Just do
[diff(i, t) for i in [cos(t), sin(t), t]]. map() really only works well when the function you want to map is already a one-argument function. Aaron Meurer On Tue, Nov 8, 2011 at 5:32 PM, Roberto Colistete Jr. <[email protected]> wrote: > Hi Aaron Meurer, > > Yes, I have used : > > map(lambda var : diff(var,t), [cos(t), sin(t), t]) > > without problems and suggested it to my students because it works in more > versions of SymPy. > > I have followed your link and verified that other functions, like 'sin', > aren't anymore 'listable'. So it isn't only 'diff'. > > Best regards, > > Roberto > > > Em 08-11-2011 22:18, Aaron Meurer escreveu: >> >> This probably wasn't intended, but I don't think we will fix it. See >> the discussion at >> http://code.google.com/p/sympy/issues/detail?id=2622. If you want to >> apply the operation over a list, you should use map() or a list >> comprehension. >> >> Aaron Meurer >> >> On Tue, Nov 8, 2011 at 5:15 PM, Roberto Colistete Jr. >> <[email protected]> wrote: >>> >>> Hi, >>> >>> On SymPy 0.6.7 the 'diff' function works on lists. But on SymPy >>> 0.7.1 it doesn't, for example : >>> >>> In [1]: diff([cos(t), sin(t), exp(t), t) >>> >>> --------------------------------------------------------------------------- >>> AttributeError Traceback (most recent call >>> last) >>> /home/roberto/<ipython-input-6-14d9fa9d6a32> in<module>() >>> ----> 1 diff([cos(t),sin(t),t],t) >>> >>> /usr/local/lib/python2.6/dist-packages/sympy/core/function.pyc in >>> diff(f, *symbols, **kwargs) >>> 1104 """ >>> 1105 kwargs.setdefault('evaluate', True) >>> -> 1106 return Derivative(f, *symbols, **kwargs) >>> 1107 >>> 1108 def expand(e, deep=True, modulus=None, power_base=True, >>> power_exp=True, \ >>> >>> /usr/local/lib/python2.6/dist-packages/sympy/core/function.pyc in >>> __new__(cls, expr, *symbols, **assumptions) >>> 672 if evaluate: >>> 673 if set(sc[0] for sc in symbol_count >>> --> 674 ).difference(expr.free_symbols): >>> 675 return S.Zero >>> 676 >>> >>> AttributeError: 'list' object has no attribute 'free_symbols' >>> >>> This is a new feature or a bug ? >>> >>> 'integrate' works on lists, by the way. >>> >>> Thanks in advance, >>> >>> Roberto >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "sympy" 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?hl=en. >>> >>> > > -- > You received this message because you are subscribed to the Google Groups > "sympy" 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?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sympy" 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?hl=en.
