title: IndexError: invalid index to scalar variable on 2d array?
body: <p>I have an array that is 10 by 21 and is filled with zeros. I'm trying to go through the first column and rewrite each element according to an equation I am given. However, this equation requires calling certain elements in the array, depending on what the x and y values are. When I run this code:</p>
  
  <pre><code>from __future__ import division
  import numpy as np
  
  
  z = 10
  p = 21
  phi = np.zeros((p, z))
  
  po = 1.0
  for po in range(p):
      i = 0
      while i &lt;= 20:
          a = phi[po + (po - 1), 0]
          b = 1 + ((po - 1)/(2))
          c = phi[po - (po - 1), 0]*(1 - ((po - 1)/(2)))
          d = phi[po, 0]
          e = phi[po, 0]
          phi = (1/4)*(a * b + c + d + e)
          i = i + 1
          po = po + 1
  </code></pre>
  
  <p>I get the error "IndexError: invalid index to scalar variable." I don't understand why phi is not indexing properly.</p>
  
  <p>I have tried to removed the 0 inside the brackets and also changing the brackets to parenthesis. I am expecting to get new values written over the zeros in the first column. I am new to Python, so I am not yet too familiar with how arrays work, so sorry in advance if my code is too simple or has more than this error.</p>