# How to save additional data in or with a solution when using DifferentialEquations

**URL:** <https://discourse.julialang.org/t/how-to-save-additional-data-in-or-with-a-solution-when-using-differentialequations/33892>\
**Category:** Modelling & Simulations\
**Created:** [January 28, 2020, 2:16pm UTC](https://discourse.julialang.org/t/how-to-save-additional-data-in-or-with-a-solution-when-using-differentialequations/33892 "2020-01-28T14:16:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)\
**Post date:** [January 28, 2020, 2:16pm UTC](https://discourse.julialang.org/t/how-to-save-additional-data-in-or-with-a-solution-when-using-differentialequations/33892/1 "2020-01-28T14:16:09Z")

</div>

Is there an idiom for saving non-state variables in or with the solution?

I would like to be able to list additional variables (either intermediate ones that I calculate anyway or derived ones of interest) and have them be saved at the same time steps and accessible with the same interpolation methods as the state variables for easy plotting.

These can all be determined from the state variables of course, but doing so has required refactoring and more complicated plotting commands. I’m guessing there’s an easier way and I’m not seeing it.

Thanks.

---

<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:** [January 28, 2020, 2:21pm UTC](https://discourse.julialang.org/t/how-to-save-additional-data-in-or-with-a-solution-when-using-differentialequations/33892/2 "2020-01-28T14:21:26Z")

</div>

For now we have [https://docs.juliadiffeq.org/latest/features/callback\_library/#saving\_callback-1](https://docs.juliadiffeq.org/latest/features/callback_library/#saving_callback-1) . There may be a better way in the future.

---

<div class="post-metadata">

**Author:** ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)\
**Post date:** [January 29, 2020, 2:41am UTC](https://discourse.julialang.org/t/how-to-save-additional-data-in-or-with-a-solution-when-using-differentialequations/33892/3 "2020-01-29T02:41:58Z")

</div>

Thanks.
