# Extracting derivatives (du/dt) from an ODE problem

**URL:** <https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514>\
**Category:** Modelling & Simulations\
**Tags:** question, diffeq\
**Created:** [July 18, 2019, 7:23pm UTC](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514 "2019-07-18T19:23:25Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Hossein\_Haghi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hossein_haghi/32/9413_2.png) [@Hossein\_Haghi](https://discourse.julialang.org/u/Hossein_Haghi)\
**Post date:** [April 6, 2020, 11:06pm UTC](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514/21 "2020-04-06T23:06:41Z")

</div>

I see, that explains it.  
I am going to take a look what is going on in here! it’s not very clear for me (I’m a rookie after all!)  
However now I know what the problem was. Thank you

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [April 6, 2020, 11:15pm UTC](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514/22 "2020-04-06T23:15:06Z")

</div>

It’s not too difficult. Essentially the interpolation is just an interpolation in Θ. So that’s basically `24*r014 + 120*r015*Θ + 360*r016*Θ^2 + ...` is the polynomial for the 4th derivative in time at `t + Θ*dt`. So then the 5th derivative is just the derivative of that polynomial and divide by another dt, so then you’d drop down the powers and etc. etc.

The way we have it written out will get it done, but it’s just tedious to add the next ones. However, to get it done today, we might as well get a PR that writes out the next orders and just merge it.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [April 6, 2020, 11:22pm UTC](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514/23 "2020-04-06T23:22:19Z")

</div>

How hard would it be to do this via metaprogramming? Which defines lots of higher order derivatives?

---

<div class="post-metadata">

**Author:** ![Hossein\_Haghi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hossein_haghi/32/9413_2.png) [@Hossein\_Haghi](https://discourse.julialang.org/u/Hossein_Haghi)\
**Post date:** [April 6, 2020, 11:24pm UTC](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514/24 "2020-04-06T23:24:48Z")

</div>

Yes. Can this be automated? or would that come with a hefty performance hit? since I am assuming right now, it just jumps into the required order without extra computation.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [April 6, 2020, 11:28pm UTC](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514/25 "2020-04-06T23:28:28Z")

</div>

Metaprogramming won’t have a performance hit, someone just has to do it. How hard? Who knows. Someone has to try it first.

[Previous page](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514.md?page=1)
