title: Error in my Scipy Code for Blood Glucose Model
body: <p>When I run my code I get some sort of error and I don't know why.</p>
  
  <p>line 233, in odeint
      int(bool(tfirst)))</p>
  
  <p>RuntimeError: The size of the array returned by func (3) does not match the size of y0 (4).</p>
  
  <pre><code>from scipy.integrate import odeint
  
  # define a function containing the derivatives, i.e. the ODE
  def glucose(x,t,params):
      X,I, G, Y = x    
      k, alpha, beta, gamma_X, gamma_I, gamma_G, lamda, delta = params
      derivs = [k - gamma_X * X - beta * I * X + lamda * G * Y,
               alpha * X - gamma_I * I,
               delta * Y - gamma_X * G]
      return derivs
  
  
  
  k = 5.625 #set value
  alpha = 1.111 #the rate of insulin production
  delta= 1 #the rate of glucagon production
  beta = 0.2 #glycogen produced based on insulin
  lamda= 0.1 #glucose produced based on glycogen
  gamma_X = 0.25 #glucose used
  gamma_I = 1.0 #insulin turnover
  gamma_G= 0.5 #glucagon turnover
  
  
  
  
  params = [k, alpha, beta, gamma_X, gamma_I, delta, gamma_G, lamda]
  
  
  
  X = 6
  I = 5
  G= 4 #Glucagon
  Y= 5 #Glycagon 
  x0 = [X,I,G,Y]
  
  
  
  
  maxt = 12.0
  tstep = 0.05
  
  t = np.arange(0,maxt,tstep)
  
  glucose_out = odeint(glucose, x0, t, args=(params,))
  
  plt.plot(t,glucose_out)
  
  plt.legend(['blood glucose', 'insulin level'])
  plt.ylabel('Blood Glucose Level mmol/L , Blood Insulin 10pmol/L')
  plt.xlabel('Time/h')
  plt.title('Glucose-Insulin Regulation Model')
  </code></pre>
  
  <p>How do I get rid of the error to produce a graph?</p>