# Using automatic differentiation to compute the Taylor expansion coefficients for ODE systems

**URL:** <https://discourse.julialang.org/t/using-automatic-differentiation-to-compute-the-taylor-expansion-coefficients-for-ode-systems/118726>\
**Category:** General Usage\
**Tags:** question, ode, autodiff\
**Created:** [August 28, 2024, 5:12pm UTC](https://discourse.julialang.org/t/using-automatic-differentiation-to-compute-the-taylor-expansion-coefficients-for-ode-systems/118726 "2024-08-28T17:12:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bingwei\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bingwei_zhang/32/211636_2.png) [@Bingwei\_Zhang](https://discourse.julialang.org/u/Bingwei_Zhang)\
**Post date:** [August 28, 2024, 5:12pm UTC](https://discourse.julialang.org/t/using-automatic-differentiation-to-compute-the-taylor-expansion-coefficients-for-ode-systems/118726/1 "2024-08-28T17:12:40Z")

</div>

I am looking for a Julia package that can provide high-order Taylor expansion coefficients of the solution for a given ODE system and initial conditions using automatic differentiation. It does not need to solve the ODE. Ideally, the initial conditions should be input as intervals to allow for interval arithmetic.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 28, 2024, 7:32pm UTC](https://discourse.julialang.org/t/using-automatic-differentiation-to-compute-the-taylor-expansion-coefficients-for-ode-systems/118726/2 "2024-08-28T19:32:46Z")

</div>

(If you are trying to fit the solution to a polynomial, you might consider just evaluating the solution at a set of Chebyshev points and doing Chebyshev polynomial interpolation, for which multiple packages exist. This will have high accuracy over a whole interval, as opposed to Taylor series whose accuracy is concentrated around a single point.)

---

<div class="post-metadata">

**Author:** ![Bingwei\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bingwei_zhang/32/211636_2.png) [@Bingwei\_Zhang](https://discourse.julialang.org/u/Bingwei_Zhang)\
**Post date:** [August 28, 2024, 8:22pm UTC](https://discourse.julialang.org/t/using-automatic-differentiation-to-compute-the-taylor-expansion-coefficients-for-ode-systems/118726/3 "2024-08-28T20:22:59Z")

</div>

I’m not trying to solve the IVP; I only want to obtain the Taylor series coefficients using automatic differentiation. Each coefficient should be the Jacobian matrix of the previous coefficient multiplied by ( f ).

---

<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:** [August 28, 2024, 10:35pm UTC](https://discourse.julialang.org/t/using-automatic-differentiation-to-compute-the-taylor-expansion-coefficients-for-ode-systems/118726/4 "2024-08-28T22:35:37Z")

</div>

Do you want the taylor expansion w.r.t initial conditions or parameters? You can just use TaylorSeries.jl or TaylorDiff.jl with DifferentialEquations.jl for that. If you are looking for the Taylor expansion in time, the solution is already sol(t) a continuous higher order interpolating function, and `sol(t,Val{i})` gives the ith derivative.
