Numpy Diff Vs Gradient, The first difference is given by out[n] = a[n+1] - a[n] along the given axis, higher … numpy.