Shawn (Yuxiang) - The right way to compute this is using Runga-Kutta approximations. I'm not aware if numpy supports these. -jm
______ John Mark Agosta 650 465-4707 johnmark.ago...@gmail.com *"Unpredictable consequences are the most expected thing on earth."* * --- B. Latour* On Thu, May 1, 2014 at 2:45 PM, Yuxiang Wang <yw...@virginia.edu> wrote: > 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 > yw...@virginia.edu > +1 (434) 284-0836 > https://sites.google.com/a/virginia.edu/yw5aj/ > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion