Sympy to numpy causes the AttributeError: 'Symbol' object has no attribute 'cos'
<p>I am trying to do partial derivatives using sympy and I want to convert it to a function so that I can substitute values and estimate the derivatives at some values of t_1, t_2. The code I am using is as follows:</p>

<pre><code>import sympy as sp
import numpy as np
from sympy import init_printing
init_printing()
t_1,t_2,X_1,X_2,Y_1,Y_2,X_c1,X_c2,Y_c1,Y_c2,a_1,a_2,psi_1,psi_2,b_1,b_2= sp.symbols('t_1 t_2 X_1 X_2 Y_1 Y_2 X_c1 X_c2 Y_c1 Y_c2 a_1 a_2 psi_1 psi_2 b_1 b_2')

X_1=X_c1 + (a_1 * sp.cos(t_1) * sp.cos(psi_1)) - ((b_1) * sp.sin(t_1)* sp.sin(psi_1))

X_2=X_c2 + (a_2 * sp.cos(t_2) * sp.cos(psi_2)) - ((b_2) * sp.sin(t_2)* sp.sin(psi_2))

Y_1=Y_c1 + (a_1 * sp.cos(t_1) * sp.sin(psi_1)) + ((b_1) * sp.sin(t_1)* sp.cos(psi_1))

Y_2=Y_c2 + (a_2 * sp.cos(t_2) * sp.sin(psi_2)) + ((b_2) * sp.sin(t_2)* sp.sin(psi_2))

D=(((X_2-X_1)**2) + ((Y_2-Y_1)**2))**0.5

y_1=sp.diff(D,t_1)

y_2=sp.diff(D,t_2)

f=sp.lambdify(t_1, y_1, "numpy")

g=sp.lambdify(t_2, y_2, "numpy")
</code></pre>

<p>When I try to substitute a value for t_1 using,</p>

<pre><code>f(np.pi/2)
</code></pre>

<p>I get the following error:  </p>

<pre><code>AttributeError   Traceback (most recent call last)
&lt;ipython-input-26-f37892b21c8b&gt; in &lt;module&gt;()
----&gt; 1 f(np.pi/2)

/users/vishnu/anaconda3/lib/python3.5/site-packages/numpy    /__init__.py in &lt;lambda&gt;(_Dummy_23)

AttributeError: 'Symbol' object has no attribute 'cos'
</code></pre>

<p>I referred to the following links:</p>

<p><a href="https://stackoverflow.com/questions/32640759/what-causes-this-error-attributeerror-mul-object-has-no-attribute-cos-in">What causes this error (AttributeError: &#39;Mul&#39; object has no attribute &#39;cos&#39;) in Python?</a></p>

<p><a href="https://stackoverflow.com/questions/13336048/python-attributeerrorcos">Python AttributeError:cos</a></p>

<p>but I think my imports of numpy and sympy are not clashing unlike the cases mentioned in those links. Any help is appreciated.</p>