add a method with an fd approximation of the derivative of the function gradient. only for testing purposes [[Imported from SVN: r7130]]