[Numpy-discussion] Second order gradient in numpy

Yuxiang Wang yw5aj at virginia.edu
Thu May 1 21:01:00 EDT 2014


Hi Chris,

Thank you! This is useful information. Unfortunately, I am doing this
on data from a sensor and would be hard to fit to a simple polynomial
while avoiding overfitting.

Thanks again!

Shawn

On Thu, May 1, 2014 at 7:01 PM, Chris Barker <chris.barker at noaa.gov> wrote:
> On Thu, May 1, 2014 at 3:42 PM, Christian K. <ckkart at hoc.net> wrote:
>
>>
>> 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.
>
>
> depending on your use case, you may want to use a polynomial fit for a
> higher order derivative:
>
> np.polyder()
>
> -Chris
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
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