Added finite difference function.