Use the approximation of gradient function.