title: Using vector inputs to odeint in python scipy to solve a system of two differential equations
body: <p>I am trying to solve a system of two coupled differential equations using python odeint(). </p>
  
  <p>In this system, a function f depends on two variables f(y,t) and another function g depends on one variable g(t). For example, something like that (illustrative only):</p>
  
  <ul>
  <li>df(y,t)/dt = (1 - y) + f(y,t) + g(t)    </li>
  <li>dg(t)/dt = g(t)     </li>
  </ul>
  
  <p>I have tried using the following code:</p>
  
  <pre><code>import numpy as np
  from scipy import integrate
  
  dy = 0.05
  y = np.arange(0, 1 + dy, dy)
  dt = 1
  tmax = 100
  
  t = np.arange(0,tmax,dt)
  f = np.ones([tmax,len(y)])
  g = np.ones(tmax)
  
  def deriv(y,t):
      fi = y[0]
      gi = y[1]
  
      fprime = (1 - y) + fi + gi
      gprime = gi
  
      return [fprime, gprime]
  
  # Initial conditions
  f_ini = np.ones(len(y))*15          
  g_ini = np.array([0.3])
  sol_ini = np.concatenate((f_ini, g_ini), axis=0)
  
  # solve the DEs
  soln = integrate.odeint(deriv, sol_ini, t)
  </code></pre>
  
  <p>I get the following error at the last line of my code: </p>
  
  <blockquote>
    <p>ValueError: setting an array element with a sequence.</p>
  </blockquote>
  
  <p>I am guessing that I am not setting my initial conditions correctly. Any advice?  </p>