[Numpy-discussion] Second order gradient in numpy
Yuxiang Wang
yw5aj at virginia.edu
Thu May 1 17:45:21 EDT 2014
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)
This is what I come up. Is the the way it should be done?
I am asking this, because in numpy there isn't an option saying
np.gradient(a, order=2). I am concerned about whether this usage is
wrong, and that is why numpy does not have this implemented.
Thank you!
-Shawn
--
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
yw5aj at virginia.edu
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/
More information about the NumPy-Discussion
mailing list