title: Combining different elements of array in Numpy while doing vector operations
body: <p>I have a function <code>f</code> which I am using to evolve a Numpy array <code>z</code> repeatedly. Thus my code looks like this:</p>
  
  <pre><code>for t in range(100):
      z = f(z)
  </code></pre>
  
  <p>However, now I want to combine elements of array while evolving. For example, in simple Python, I would like to do something like this:</p>
  
  <pre><code>N = len(z)
  for t in range(100):
      for i in range(len(z)):
           z_new[i] = f(z[i]) + z[(i-1)%N] + z[(i+1)%N]
      z = z_new
  </code></pre>
  
  <p>How can achieve the same thing in Numpy vector operations so that I wouldn't have to compromise with the great speed that Numpy gives me?</p>
  
  <p>Thanks in advance</p>