title: ODEINT with multiple parameters (time-dependent)
body: <p>I'm trying to solve a single first-order ODE using ODEINT. Following is the code. I expect to get 3 values of y for 3 time-points. The issue I'm struggling with is ability to pass nth value of <strong>mt</strong> and <strong>nt</strong> to calculate <strong>dydt</strong>. I think the ODEINT passes all 3 values of <strong>mt</strong> and <strong>nt</strong>, instead just 0th, 1st or 2nd, depending on the iteration. Because of this, I get this error:</p>
  
  <blockquote>
    <p>RuntimeError: The size of the array returned by func (4) does not match the size of y0 (1).</p>
  </blockquote>
  
  <p>Interestingly, if I replace the initial condition, which is (and should be) a single value as:  a0= [2]*4, the code works, but gives me a 4X4 matrix as solution, which seems incorrect. </p>
  
  <pre><code>mt = np.array([3,7,4,2]) # Array of constants
  nt = np.array([5,1,9,3]) # Array of constants
  c1,c2,c3 = [-0.3,1.4,-0.5] # co-efficients
  para = [mt,nt] # Packing parameters
  
  #Test ODE function
  def test (y,t,extra):
      m,n = extra
      dydt = c1*c2*m - c1*y - c3*n
      return dydt
  
  a0= [2]  # Initial Condition
  tspan = range(len(mt)) # Define tspan
  
  #Solving the ODE
  yt= odeint(test, a0,tspan,args=(para,)) 
  #Plotting the ODE
  plt.plot(tspan,yt,'g')
  plt.title('Multiple Parameters Test')
  plt.xlabel('Time')
  plt.ylabel('Magnitude')
  </code></pre>
  
  <p>The first order differential equation is:</p>
  
  <blockquote>
    <p>dy/dt = c1*(c2*mt-y(t)) - c3*nt</p>
  </blockquote>
  
  <p>This equation represents a part of murine endocrine system, which I am trying to model.  The system is analogous to a two-tank system, where the first tank receives a specific hormone [at an unknown rate] but our sensor will detect that level <code>(mt)</code> at specific time intervals (1 second). This tank then feeds into the second tank, where the level of this hormone <code>(y)</code> is detected by another sensor. I labeled the levels using separate variables because the sensors that detect the levels are independent of each other and are not calibrated to each other. 'c2' may be considered as the co-efficient that shows the correlation between the two levels. Also, the transfer of this hormone from tank 1 to tank 2 is diffusion-driven. This hormone is further consumed by a biochemical process (similar to a drain valve for the second tank). At the moment, it is unclear which parameters affect the consumption; however, another sensor can detect the amount of hormone <code>(nt)</code> being consumed at a specific time interval (1 second, in this case too).</p>
  
  <p>Thus, <code>mt</code> and <code>nt</code> are the concentrations/levels of the hormone at specific time points. although only 4-element in length in the code, these arrays are much longer in my study. All sensors report the concentrations at 1 second interval - hence <code>tspan</code> consists of time points separated by 1 second.</p>
  
  <p>The objective is to determine the concentration of this hormone in the second tank (<code>y</code>) mathematically and then optimize the values of these coefficients based on the experimental data. I was able to pass these arrays <code>mt</code> and <code>nt</code> to the defined ODE and solve using ODE45 in MATLAB with no issue. I've been running into this RunTimeError, while trying to replicate the code in Python.</p>