title: Numpy - Declare a specific nx1 array
body: <p>I'm using numpy in python , in order to create a <code>nx1</code> matrix . I want the <strong>1st</strong> element of the matrix to be <code>3</code> , the <strong>2nd</strong> <code>-1</code> , then the <strong>n-1</strong> element <code>-1</code> again and at the end the <strong>n</strong> element <code>3</code>. All the <strong>in between</strong> elements , i.e. from element <strong>3</strong> to element <strong>n-2</strong> should be <code>0</code>. I've made a drawing of the mentioned matrix , is like this :
  <a href="https://i.stack.imgur.com/ht7Gm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ht7Gm.png" alt="enter image description here"></a></p>
  
  <p>I'm fairly new to python and using numpy but seems like a great tool for managing matrices. What I've tried so far is creating the <code>nx1</code> array (giving <code>n</code> some value) and initializing it to <code>0</code> . </p>
  
  <pre><code>import numpy as np
  
  n = 100
  
  I = np.arange(n)
  
  matrix = np.row_stack(0*I)
  
  print("\Matrix is \n",matrix)
  </code></pre>
  
  <p>Any clues to how i proceed? Or what routine to use ?</p>