Closed
Description
i may be misunderstanding the docstring on this function. the gradient function, describes an argument varargs
to be the sample distance in each direction, but then in the docstring example it shows
>>> x = np.array([0, 1, 2, 3, 4])
>>> dx = np.gradient(x)
>>> y = x**2
>>> np.gradient(y, dx, edge_order=2)
array([-0., 2., 4., 6., 8.])
which seems like dx
is the sample distance between each sample. so this example seems to indicate that varargs
is more accurately described by dx1, dx2,...dxN
, not dx,dy,dz,...
.
the ealier interpretation appears to align more closely with some test case results as well.