Hello all,

I have the following ODE system in which p is a parameterized function:

```
function fcd!(du, u, p, t)
du[1] = p(t) - u[1]
du[2] = p(t) / u[1] - u[2]
end
```

I wish to solve the ODE using DifferentialEquations.jl and also save the value of `p(t)`

at all time points.

Right now I did so in a data frame, `conc`

is `p(t)`

in the ODE.

```
DataFrame(sol) |>
@mutate(u = conc.(_.timestamp))
```

Is there a more elegant way to save `p(t)`

?

Hello, `ModelingToolkit.jl`

(the symbolic part of `DifferentialEquations.jl`

) provides tracing for non-state variables right in the solution interface and plot recipes. Specifying a time-variable forcing function is possibly the closest to what you want.

1 Like

Unfortunately I need to dynamically redefine the function to save time on Julia’s start-up overhead time. This does not work with `Symbolics.jl`

.

1 Like

Perhaps SavingCallback could meet your needs. It can save extra information in the simulation.

1 Like