Am 01.05.14 18:45, schrieb Yuxiang Wang: > Hi all, > > I am trying to calculate the 2nd-order gradient numerically of an > array in numpy. > > import numpy as np > a = np.sin(np.arange(0, 10, .01)) > da = np.gradient(a) > dda = np.gradient(da)
It looks like you are looking for the derivative rather than the gradient. Have a look at: np.diff(a, n=1, axis=-1) n is the order if the derivative. Christian _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion