diff options
author | Alessandro Pietro Bardelli <apbard@users.noreply.github.com> | 2017-02-12 12:55:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-12 12:55:12 +0100 |
commit | 829b83ce53cc76b94979910e196d3a17e8bd2538 (patch) | |
tree | e5c329793952988b7de53d2c87ec59b514f5f542 /numpy/lib/function_base.py | |
parent | 51a824051c82b36c1d0f17f81c6a9ef24375cf42 (diff) | |
download | numpy-829b83ce53cc76b94979910e196d3a17e8bd2538.tar.gz |
Revert "DOC: gradient uses 1st order central difference in the interior"
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 30bc1a548..51353351f 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1491,7 +1491,7 @@ def gradient(f, *varargs, **kwargs): """ Return the gradient of an N-dimensional array. - The gradient is computed using first order accurate central differences + The gradient is computed using second order accurate central differences in the interior and either first differences or second order accurate one-sides (forward or backwards) differences at the boundaries. The returned gradient hence has the same shape as the input array. @@ -1630,7 +1630,7 @@ def gradient(f, *varargs, **kwargs): "Shape of array too small to calculate a numerical gradient, " "at least two elements are required.") - # Numerical differentiation: 1st order edges, 1st order interior + # Numerical differentiation: 1st order edges, 2nd order interior if y.shape[axis] == 2 or edge_order == 1: # Use first order differences for time data out = np.empty_like(y, dtype=otype) @@ -1653,7 +1653,7 @@ def gradient(f, *varargs, **kwargs): # 1D equivalent -- out[-1] = (y[-1] - y[-2]) out[slice1] = (y[slice2] - y[slice3]) - # Numerical differentiation: 2nd order edges, 1st order interior + # Numerical differentiation: 2st order edges, 2nd order interior else: # Use second order differences where possible out = np.empty_like(y, dtype=otype) |