Return the gradient of an N-dimensional array.
The gradient is computed using central differences in the interior and first differences at the boundaries. The returned gradient hence has the same shape as the input array.
Parameters: | f : array_like
`*varargs` : scalars
|
---|---|
Returns: | g : ndarray
|
Examples
>>> np.gradient(np.array([[1,1],[3,4]]))
[array([[ 2., 3.],
[ 2., 3.]]),
array([[ 0., 0.],
[ 1., 1.]])]