title: Numpy quirk: Apply function to all pairs of two 1D arrays, to get one 2D array
body: <p>Let's say I have 2 one-dimensional (1D) numpy arrays, <code>a</code> and <code>b</code>, with lengths <code>n1</code> and <code>n2</code> respectively. I also have a function, <code>F(x,y)</code>,  that takes two values. Now I want to apply that function to each pair of values from my two 1D arrays, so the result would be a 2D numpy array with shape <code>n1, n2</code>. The <code>i, j</code> element of the two-dimensional array would be <code>F(a[i], b[j])</code>.</p>
  
  <p>I haven't been able to find a way of doing this without a horrible amount of for-loops, and I'm sure there's a much simpler (and faster!) way of doing this in numpy.</p>
  
  <p>Thanks in advance!</p>