title: Finding gradient of an unknown function at a given point in Python
body: <p>I am asked to write an implementation of the gradient descent in python with the signature <code>gradient(f, P0, gamma, epsilon)</code> where f is an unknown and possibly multivariate function, P0 is the starting point for the gradient descent, gamma is the constant step and epsilon the stopping criteria.</p>
  
  <p>What I find tricky is how to evaluate the gradient of <code>f</code> at the point <code>P0</code> without knowing anything on <code>f</code>. I know there is <code>numpy.gradient</code> but I don't know how to use it in the case where I don't know the dimensions of <code>f</code>. Also, <code>numpy.gradient</code> works with samples of the function, so how to choose the right samples to compute the gradient at a point without any information on the function and the point?</p>