# Tracking dynamical increments du and accompanying variables during a DynamicalSystems run

**URL:** https://discourse.julialang.org/t/tracking-dynamical-increments-du-and-accompanying-variables-during-a-dynamicalsystems-run/107558
**Category:** Modelling & Simulations
**Tags:** question, package
**Created:** [December 13, 2023, 10:20am UTC](https://discourse.julialang.org/t/tracking-dynamical-increments-du-and-accompanying-variables-during-a-dynamicalsystems-run/107558 "2023-12-13T10:20:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Niall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niall/32/22517_2.png) [@Niall](https://discourse.julialang.org/u/Niall)
#### Post date: [December 13, 2023, 10:20am UTC](https://discourse.julialang.org/t/tracking-dynamical-increments-du-and-accompanying-variables-during-a-dynamicalsystems-run/107558/1 "2023-12-13T10:20:47Z")

</div>

Hi. I have two things that I want from DynamicalSystems, and I’m not sure how to get them:

- Is there some way of retrieving the dynamical increment values `du` during the running of a DynamicalSystem? It would be useful for investigating the internal causality underlying events in complex systems with many state variables.

- Is there a way to carry variables through a simulation? One way would be to store them as parameters and reset their value manually using set\_parameter!, but I get the impression that’s not what the parameters are intended for.

Thanks and best wishes,  
Niall.

---

<div class="post-metadata">

### Author: ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)
#### Post date: [December 13, 2023, 12:15pm UTC](https://discourse.julialang.org/t/tracking-dynamical-increments-du-and-accompanying-variables-during-a-dynamicalsystems-run/107558/2 "2023-12-13T12:15:36Z")

</div>

Hi there!

1. What does “retrieve” mean? Is enough for you to add `@show du` before the function returns? If you want to store them, you can make one of the parameters just a container for you to store the `du` state.
2. What does “carry variables through” mean? This one I didn’t get! In fact, what does “variable” mean in this context? A dynamic (state) variable? Perhaps you should tell us what you want to achieve in concept, rather than the technical thing you do to achieve what you want.

---

<div class="post-metadata">

### Author: ![Niall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niall/32/22517_2.png) [@Niall](https://discourse.julialang.org/u/Niall)
#### Post date: [December 14, 2023, 8:32am UTC](https://discourse.julialang.org/t/tracking-dynamical-increments-du-and-accompanying-variables-during-a-dynamicalsystems-run/107558/3 "2023-12-14T08:32:56Z")

</div>

Thanks. 😀 My situation is this: I’m writing a course for second-year biology students on using dynamical modelling to model cellular, physiological and ecological system, and am intending to use DynamicalSystems as the basis for the course. Students will need to debug their dynamical models, and so will need to investigate how features of their model change dynamically over time.

For example, when simulating glycolysis, they might want to explore how oscillations arise by calling `trajectory()` and have it return a history of how two different flows `du` of material between two compounds ADP and F6P vary over time. Or they might want to define their own variable `energy`, have it updated on each step, and study its history after a run to see how it varies.

I realise that I could have them `step!()` through the simulation to update variables, but I’m assuming it’s more efficient to use `trajectory()`, and in any case, I want the students to concentrate on the biological content, rather than on implementation details. I also gained the impression from your reply to [another](https://discourse.julialang.org/t/debugging-an-anonymous-function-passed-to-dynamicalsystems/106890/4) post of mine, that it would be an abuse of their intent to store changing values in a parameter.
