title: numpy gradient function and numerical derivatives
body: <p>The array the <code>numpy.gradient</code> function returns depends on the number of data-points/spacing of the data-points. Is this expected behaviour? For example:</p>
  
  <pre><code>y = lambda x: x
  
  x1 = np.arange(0,10,1)
  x2 = np.arange(0,10,0.1)
  x3 = np.arange(0,10,0.01)
  
  plt.plot(x1,np.gradient(y(x1)),'r--o')
  plt.plot(x2,np.gradient(y(x2)),'b--o')
  plt.plot(x3,np.gradient(y(x3)),'g--o')
  </code></pre>
  
  <p>returns the <img src="https://i.stack.imgur.com/VxzHj.png" alt="ATTACHED"> plot. </p>
  
  <p>Only the gradient of y(x1) returns the correct result. What is going on here? Is there a better way to compute the numerical derivative using numpy?</p>
  
  <p>Cheers</p>