summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authordrabach <ab@meistens-immer.de>2017-02-12 03:46:53 +0100
committerCharles Harris <charlesr.harris@gmail.com>2017-02-11 19:46:53 -0700
commit5de1a8215edc5982458473b2ef6da091beb4b19d (patch)
treee8b31178c83c1976eb55781127ce02b14a6503e9 /numpy/lib/function_base.py
parentbcae38abb15ef27fea0c581f122ff5a79574277f (diff)
downloadnumpy-5de1a8215edc5982458473b2ef6da091beb4b19d.tar.gz
DOC: gradient uses 1st order central difference in the interior (#8605)
The gradient function uses 1st order central difference in the interior, not second order.
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 51353351f..30bc1a548 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 second order accurate central differences
+ The gradient is computed using first 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, 2nd order interior
+ # Numerical differentiation: 1st order edges, 1st 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: 2st order edges, 2nd order interior
+ # Numerical differentiation: 2nd order edges, 1st order interior
else:
# Use second order differences where possible
out = np.empty_like(y, dtype=otype)