# Best way to take derivatives of unevenly spaced data (with interpolations? discrete derivatives?)

**URL:** <https://discourse.julialang.org/t/best-way-to-take-derivatives-of-unevenly-spaced-data-with-interpolations-discrete-derivatives/54097>\
**Category:** Numerics\
**Tags:** intervals, interpolations\
**Created:** [January 28, 2021, 4:57am UTC](https://discourse.julialang.org/t/best-way-to-take-derivatives-of-unevenly-spaced-data-with-interpolations-discrete-derivatives/54097 "2021-01-28T04:57:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![macd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/macd/32/3257_2.png) [@macd](https://discourse.julialang.org/u/macd)\
**Post date:** [January 28, 2021, 6:42am UTC](https://discourse.julialang.org/t/best-way-to-take-derivatives-of-unevenly-spaced-data-with-interpolations-discrete-derivatives/54097/4 "2021-01-28T06:42:17Z")

</div>

I think your best bet would be to use ApproxFun. Once you have your data as a “Fun”, it is straightforward to take derivatives and integrate. Unfortunately, you need your data to be on a Chebshev grid for ApproxFun. If you are on an even grid, or and uneven one, a rational approximation can help. I wrote a small package ([https://github.com/macd/BaryRational.jl](https://github.com/macd/BaryRational.jl)) which was recently registered. The readme has an example on how to use the AAA algorithm to get such data into ApproxFun as a Fun.

---

_[View the full topic](https://discourse.julialang.org/t/best-way-to-take-derivatives-of-unevenly-spaced-data-with-interpolations-discrete-derivatives/54097)._
