title: lambdify a sympy expression that contains a Derivative of UndefinedFunction
body: <p>I have several expressions of an undefined function some of which contain the corresponding (undefined) derivatives of that function. Both the function and its derivatives exist only as numerical data. I want to make functions out of my expressions and then call that function with the corresponding numerical data to numerically compute the expression. Unfortunately I have run into a problem with lambdify.</p>
  
  <p>Consider the following simplified example:</p>
  
  <pre><code>import sympy
  import numpy
  
  # define a parameter and an unknown function on said parameter
  t = sympy.Symbol('t')
  s = sympy.Function('s')(t)
  
  # a "normal" expression
  a = t*s**2
  print(a)
  #OUT: t*s(t)**2
  
  # an expression which contains a derivative
  b = a.diff(t)
  print(b)
  #OUT: 2*t*s(t)*Derivative(s(t), t) + s(t)**2
  
  # generate an arbitrary numerical input
  # for demo purposes lets assume that s(t):=sin(t)
  t0 = 0
  s0 = numpy.sin(t0)
  sd0 = numpy.cos(t0)
  
  # labdify a
  fa = sympy.lambdify([t, s], a)
  va = fa(t0, s0)
  print (va)
  #OUT: 0
  
  # try to lambdify b
  fb = sympy.lambdify([t, s, s.diff(t)], b)  # this fails with syntax error
  vb = fb(t0, s0, sd0)
  print (vb)
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>  File "&lt;string&gt;", line 1
      lambda _Dummy_142,_Dummy_143,Derivative(s(t), t): (2*_Dummy_142*_Dummy_143*Derivative(_Dummy_143, _Dummy_142) + _Dummy_143**2)
                                             ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>Apparently the Derivative object is not resolved correctly, how can I work around that?</p>
  
  <p>As an alternative to lambdify I'm also open to using theano or cython based solutions, but I have encountered similar problems with the corresponding printers.</p>
  
  <p>Any help is appreciated.</p>