Tracking dynamical increments du and accompanying variables during a DynamicalSystems run

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,

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.

Thanks. :grinning: 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 post of mine, that it would be an abuse of their intent to store changing values in a parameter.