8000 docstring on `gradient`, confusing · Issue #6847 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
docstring on gradient, confusing #6847
Closed
@arsenovic

Description

@arsenovic

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0