sympy - cos of a list of variables
<p>I try to implement a cos function of a list with variables with sympy. Here an easy example: </p>

<pre><code>    from sympy import *
    x = Symbol('x')
    cos([x+1,x+2,x+3])
</code></pre>

<p>But then the error </p>

<pre><code>AttributeError: 'list' object has no attribute 'is_Number' 
</code></pre>

<p>occurs and not what I've expected  <code>array([cos([x+1]),cos([x+2]),cos([x+3])])</code>.
Is there an easy way to use the cos as <code>numpy.cos()</code>?</p>

<p>Use the <a href="https://docs.python.org/3/library/functions.html#map" rel="nofollow">Python builtin <code>map</code> function</a> to apply <code>sympy.cos</code> to each element in the list:</p>

<pre><code>import sympy as sy
x = sy.Symbol('x')
print(list(map(sy.cos, [x+1,x+2,x+3])))
</code></pre>

<p>yields</p>

<pre><code>[cos(x + 1), cos(x + 2), cos(x + 3)]
</code></pre>

python sympy