title: Implementing a loop for a system of ordinary differential equations
body: <p>I am new here and with Python. I am working on a code for numerical solutions of ordinary differential equation systems.
  My problem: I need to implement a loop inside a function. After that, I need to integrate that function (odeint), but it doesn't work.</p>
  
  <p>Here is the (working) code without the loop:</p>
  
  <pre><code>from scipy.integrate import odeint
  from pylab import * # for plotting commands
  def deriv(y,t): # return derivatives of the array y
      a = 2.0
      return array([ y*a*(1-y/10)]) 
  time = linspace(0,500,1000)
  yinit = 1 
  y = odeint(deriv,yinit,time)
  figure()
  plot(time,y)
  xlabel('t')
  ylabel('y')
  show()
  </code></pre>
  
  <p>And here is the non working code:</p>
  
  <pre><code>from scipy.integrate import odeint
  from pylab import * # for plotting commands
  def deriv(y,t): # return derivatives of the array y
      a = 2.0
      for i in range(0,10):
          return array([ y[i]*a*(1-y[i]/10) ]) 
  time = linspace(0,500,1000)
  yinit = linspace(1,1,10) 
  y = odeint(deriv,yinit,time)
  figure()
  plot(time,y[:,0],time,y[:,1])
  xlabel('t')
  ylabel('y')
  show()
  </code></pre>
  
  <p>Can Someone help me?</p>