[Numpy-discussion] Second order gradient in numpy

John Mark Agosta johnmark.agosta at gmail.com
Fri May 2 16:32:03 EDT 2014


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.agosta at gmail.com  *"Unpredictable consequences are the most
expected thing on earth."*
*
                                                 --- B. Latour*


On Thu, May 1, 2014 at 2:45 PM, Yuxiang Wang <yw5aj at 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
> yw5aj at virginia.edu
> +1 (434) 284-0836
> https://sites.google.com/a/virginia.edu/yw5aj/
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140502/1b7bfa7c/attachment.html>


More information about the NumPy-Discussion mailing list