summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-02-12 06:43:10 -0700
committerGitHub <noreply@github.com>2017-02-12 06:43:10 -0700
commita9d694168eedc6fb433688d2265de4e196ed87d5 (patch)
treee5c329793952988b7de53d2c87ec59b514f5f542 /numpy/lib/function_base.py
parent51a824051c82b36c1d0f17f81c6a9ef24375cf42 (diff)
parent829b83ce53cc76b94979910e196d3a17e8bd2538 (diff)
downloadnumpy-a9d694168eedc6fb433688d2265de4e196ed87d5.tar.gz
Merge pull request #8606 from apbard/revert-8605-master
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.py6
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)