The function to differentiate.
The point at which to take the derivative.
The function value at x, i.e. f(x)
A characteristic scale for f. When this is positive, the forward-difference formula is used, and when it is negative, the backward-difference formula is used.
An approximation to the derivative of f at the point x. The relative error in the result is at best on the order of sqrt(real.epsilon). Usually it is much higher.
Calculate the derivative of a function using a two-point formula, i.e. a forward- or backward-difference formula.
This method only evaluates the function once (in addition to the function value provided by the user), and is therefore the fastest way to compute a derivative. However, it is also the least accurate method, and should only be used if the function is very expensive to compute and you have already calculated f(x).