title: Updating a python array without loops?
body: <p>I have a recursive relation, that I want to update without using loops for speed.  </p>
  
  <p>For example </p>
  
  <pre><code>import numpy as np
  x=np.array([1,0,0,0,0])
  x[1:]=(1+x[0:len(x)-1])**2.
  </code></pre>
  
  <p>This returns <code>[1,4,1,1,1]</code> for <code>x</code>, but I want <code>[1,4,25,676,458329]</code>.  I know this can be done with a loop, but I'm really trying to avoid loops.</p>
  
  <p>For example,</p>
  
  <pre><code>for i in range(1,len(x)):
      x[i]=(1+x[i-1])**2.
  </code></pre>
  
  <p>will return <code>[1,4,25,676,458329]</code></p>