title: Multiplying column and row vectors in Numpy
body: <p>I'd like to multiply two vectors, one column (i.e., (N+1)x1), one row (i.e., 1x(N+1)) to give a (N+1)x(N+1) matrix. I'm fairly new to Numpy but have some experience with MATLAB, this is the equivalent code in MATLAB to what I want in Numpy:</p>
  
  <pre><code>n = 0:N; 
  xx = cos(pi*n/N)';
  T = cos(acos(xx)*n');
  </code></pre>
  
  <p>in Numpy I've tried:</p>
  
  <pre><code>import numpy as np
  n = range(0,N+1)
  
  pi = np.pi
  xx = np.cos(np.multiply(pi / float(N), n))
  
  xxa = np.asarray(xx)
  na = np.asarray(n)
  nd = np.transpose(na)
  
  T = np.cos(np.multiply(np.arccos(xxa),nd))
  </code></pre>
  
  <p>I added the asarray line after I noticed that without it Numpy seemed to be treating xx and n as lists. <code>np.shape(n)</code>, <code>np.shape(xx)</code>, <code>np.shape(na)</code> and <code>np.shape(xxa)</code> gives the same result: <code>(100001L,)</code></p>