this post was submitted on 22 Mar 2024
6 points (100.0% liked)

Julia

265 readers
1 users here now

founded 1 year ago
MODERATORS
 

Victor Buendía (@[email protected]) writes:

Turns out that #julialang does not have the equivalent of Numpy's gradient function. So I went to Numpy docs and source code and adapted it.

Numpy's gradient is great because it uses centered differences, so it's way more accurate than naively getting the forward differences. Also, supports non-equally spaced grids.

In case someone needs it (for 1D arrays only), here it is:

https://gist.github.com/VictorSeven/996e0745e820dde0610ada9e9e025844

Source

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here