title: Fit differential equation with scipy
body: <p>how can I fit the differential function of the followint scipy tutorial</p>
  
  <p><a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.odeint.html" rel="nofollow noreferrer">Scipy Differential Equation Tutorial</a>?</p>
  
  <p>In the end I want to fit some datapoints that follow a  set of two differential equations with six parameters in total but I'd like to start with an easy example. So far I tried the functions <code>scipy.optimize.curve_fit</code> and <code>scipy.optimize.leastsq</code> but I did not get anywhere.</p>
  
  <p>So this is how far I came:</p>
  
  <pre><code>import numpy as np
  import scipy.optimize as scopt
  import scipy.integrate as scint
  import scipy.optimize as scopt
  
  def pend(y, t, b, c):
      theta, omega = y
      dydt = [omega, -b*omega - c*np.sin(theta)]
      return dydt
  
  
  def test_pend(y, t, b, c):
      theta, omega = y
      dydt = [omega, -b*omega - c*np.sin(theta)]
      return dydt
  
  b = 0.25
  c = 5.0
  
  y0 = [np.pi - 0.1, 0.0]
  guess = [0.5, 4]
  t = np.linspace(0, 1, 11)
  
  sol = scint.odeint(pend, y0, t, args=(b, c))
  
  popt, pcov = scopt.curve_fit(test_pend, guess, t, sol)
  </code></pre>
  
  <p>with the following error message:</p>
  
  <pre><code>ValueError: too many values to unpack (expected 2)
  </code></pre>
  
  <p>And I'm sorry as this is assumingly a pretty simple question but I don't get it to work. So thanks in advance.</p>