title: TypeError: 'float' object is not subscriptable in Python "for recursive equations in a double for loop, probably index-related problem"
body: <p>I am trying to represent a real-life barn (closed queuing network) problem with some AMVA (Approximate Mean Value Analysis). I have 6 recursive equations to be computed. I am getting this <strong>TypeError: 'float' object is not subscriptable</strong> for the <strong>last line of my code</strong>. I think it might be index-related, but I am not sure of course. I would appreciate any idea that could help me.</p>
  
  <pre><code>import math
  
  H = 10 #number of cows
  c = [0,1,1,12,3,27,H] #capacity of the stations
  v = [0,0.164,0.155,0.235,0.17,0.276,1] #relative visit frequencies to the stations
  s = [0,8.41,6.38,15.0,3.18,38.9,5.36] #mean service times
  sigma = [0,2.52,6.25,11.9,2.3,60.3,0] #st. dev. of service times
  
  R = [0] #residual service times
  
  for i in range(1,7):
      r = (s[i]/2)*(1+((sigma[i]/s[i])**2))
      R.append(r)
  
  
  W = [[0 for x in range (7)] for y in range (H+1)] #mean waiting time at station i
  S = [[0 for x in range (7)] for y in range (H+1)] #mean visit time at station i (waiting + service time)
  ARRIVAL = [[0 for x in range (7)] for y in range (H+1)] #mean number of visits per time unit to station i
  L = [[0 for x in range (7)] for y in range (H+1)] #mean number of cows waiting at station i
  UTIL = [[0 for x in range (7)] for y in range (H+1)] #server utilization at station i
  Q = [[0 for x in range (7)] for y in range (H+1)] #probability that all servers are busy at station i
  
  
  for h in range(1,H+1): #Recursive equations (to find variables when h = 2, we need variables when h = 1 for example)
      for i in range(1,7):
          W[h][i] = Q[h-1][i]*R[i]/c[i] + L[h-1][i]*s[i]/c[i]
          S[h][i] = W[h][i] + s[i]
          ARRIVAL[h][i] = (v[i]*h) / (sum(v[i]*S[h][i] for i in range(1,7)))
          L[h][i] = ARRIVAL[h][i] * W[h][i]
          UTIL = (ARRIVAL[h][i]*s[i])/c[i]
          if h &lt; c[i]:
              Q[h][i] = 0
          else:
              Q[h][i] = (((c[i]*UTIL[h][i])**c[i])/math.factorial(c[i]))*((1-UTIL[h][i])*sum(((c[i]*UTIL[h][i])**k)/math.factorial(k) for k in range(c[i]-1))+(((c[i]*UTIL[h][i])**c[i])/math.factorial(c[i])))**-1
  </code></pre>