title: IndexError: index 3 is out of bounds for axis 1 with size 3
body: <p>I would like to solve the error: </p>
  
  <blockquote>
    <p>IndexError: index 3 is out of bounds for axis 1 with size 3</p>
  </blockquote>
  
  <pre><code>from numpy import *
  from pylab import *
  
  def SIR2(I0, beta, gama, w, sigma, p, dt, tmax):
      N = int(tmax / dt) + 1  # nombre de pas de temps
      T = zeros([N + 1, 3])
      T[0, 0] = 1000000 - I0
      T[0, 1] = I0
  
      for i in range(N + 1):
          T[i + 1, 0] = T[i, 0] - dt * (beta * T[i, 0] * T[i, 1] + p * T[i, 0] - w * T[i, 2])
          T[i + 1, 1] = T[i, 1] + dt * T[i, 1] * (beta * T[i, 0] - gama - sigma)
          T[i + 1, 2] = T[i, 2] + dt * (gama * T[i, 1] + p * T[i, 0] + w * T[i, 2])
          T[i + 1, 3] = sigma * T[i, 1] * dt + T[i, 3]
  
      return T
  
  beta = 1 / 3000000
  gama = 1 / 20
  
  I0 = 10
  p = 0
  sigma = 5 / 1000
  w = 0
  dt = 0.05
  tmax = 150
  T = SIR2(I0, beta, gama, w, sigma, p, dt, tmax)
  
  N = int(tmax / dt) + 1
  X = zeros(N + 1)
  
  for i in range(N + 1):
      X[i] = i * dt
  
  plot(X, T[:, 0])
  plot(X, T[:, 1])
  plot(X, T[:, 2])
  plot(X, T[:, 3])
  
  show()
  </code></pre>