Added gradient check for df/dx.