# Numerical differentiation and Integration

**URL:** <https://discourse.julialang.org/t/numerical-differentiation-and-integration/15838>\
**Category:** General Usage\
**Created:** [October 3, 2018, 6:46pm UTC](https://discourse.julialang.org/t/numerical-differentiation-and-integration/15838 "2018-10-03T18:46:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ferran\_Mazzanti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ferran_mazzanti/32/7458_2.png) [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Post date:** [October 3, 2018, 6:46pm UTC](https://discourse.julialang.org/t/numerical-differentiation-and-integration/15838/1 "2018-10-03T18:46:18Z")

</div>

Hi folks,  
I was wondering if somebody could recommend the best(?) package for numerical differentiation and integration. I’m mostly interested in numerics, which means that I usually have a set of points on a grid and wnat to perform the first and second derivative. What I mean to say is that it is not an analytic form what I have, it is just a collection of numbers of f(x) for a grid of points x.  
Thx in advance,  
Ferran.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 3, 2018, 6:50pm UTC](https://discourse.julialang.org/t/numerical-differentiation-and-integration/15838/2 "2018-10-03T18:50:09Z")

</div>

A small example with representative inputs would help give more detailed suggestions. The “goto” AD-packages are

- [https://github.com/JuliaDiff/ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl)
- [https://github.com/JuliaDiff/ReverseDiff.jl](https://github.com/JuliaDiff/ReverseDiff.jl)

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [October 3, 2018, 7:12pm UTC](https://discourse.julialang.org/t/numerical-differentiation-and-integration/15838/3 "2018-10-03T19:12:56Z")

</div>

Maybe [GSoC 2017: Efficient Discretizations of PDE Operators](https://julialang.org/blog/2017/09/gsoc-derivative_operators)

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [October 3, 2018, 7:30pm UTC](https://discourse.julialang.org/t/numerical-differentiation-and-integration/15838/4 "2018-10-03T19:30:11Z")

</div>

Is your function ‘f’ a black box (e.g coming from real-world measurements)? If so, ForwardDiff and ReverseDiff are not what you need.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [October 3, 2018, 7:31pm UTC](https://discourse.julialang.org/t/numerical-differentiation-and-integration/15838/5 "2018-10-03T19:31:27Z")

</div>

If you have the original function, the recommendations to use automatic-differentiation are worth paying attention to. But if you have a grid of values, [Interpolations](https://github.com/JuliaMath/Interpolations.jl) may be closer to what you’re looking for. (It can compute both `gradient` and `hessian`.)
