title: numpy: Different results between diff and gradient for finite differences
body: <p>I want to calculate the numerical derivative of two arrays <code>a</code> and <code>b</code>.</p>
  
  <p>If I do </p>
  
  <pre><code>c = diff(a) / diff(b)
  </code></pre>
  
  <p>I get what I want, but I loose the edge (the last point) so <code>c.shape ~= a.shape</code>.</p>
  
  <p>If I do</p>
  
  <pre><code>c = gradient(a, b)
  </code></pre>
  
  <p>then <code>c.shape = a.shape</code>, but I get a completely different result.</p>
  
  <p>I have read how gradient is calculated in numpy and I guess it does a completely different thing, although I dont understand quite well the difference yet. But is there a way or another function to calculate the differential which also gives the values at the edges?</p>
  
  <p>And why is the result so different between <code>gradient</code> and <code>diff</code>?</p>