title: Python NumPy Arrays
body: <p>Im working with two arrays, trying to work with them like a 2 dimensional array. I'm using a lot of vectorized calculations with NumPy. Any idea how I would populate an array like this:</p>
  
  <pre><code>X = [1, 2, 3, 1, 2, 3, 1, 2, 3]
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>X = [0.2, 0.4, 0.6, 0.8, 0.2, 0.4, 0.6, 0.8, 0.2, 0.4, 0.6, 0.8, 0.2, 0.4, 0.6, 0.8]
  </code></pre>
  
  <hr>
  
  <p>Ignore the first part of the message.</p>
  
  <p>I had to populate two arrays in a form of a grid. But the grid dimensions varied from the users, thats why I needed a general form. I worked on it all this morning and finally got what I wanted. </p>
  
  <p>I apologize if I caused any confusion earlier. English is not my tongue language, and sometimes it is hard for me to explain things.</p>
  
  <p>This is the code that did the job for me:</p>
  
  <pre><code>    myIter = linspace(1, N, N)
      for x in myIter:
          for y in myIter:
              index = ((x - 1)*N + y) - 1
              X[index] = x / (N+1)
              Y[index] = y / (N+1)
  </code></pre>
  
  <p>The user inputs N.
  And the length of X, Y is N*N.</p>