-
-
Notifications
You must be signed in to change notification settings - Fork 236
Closed
Labels
Description
The proposed plan is to support difference equations containing DIfference operator in ODESystems using PeriodicCallbacks.
This could involve the following workflow:
Difining difference and differential equations together:
using ModelingToolkit
@parameters t σ ρ β
@variables x(t) y(t) z(t)
δ = Differential(t)
D = Difference(t; dt=0.01)
eqs = [
δ(x) ~ σ*(y-x),
δ(y) ~ x*(ρ-z)-y,
δ(z) ~ x*y - β*z,
D(y) ~ x
]Manually mentioning which are the difference variables while defining the ODESystem using an optional kwarg:
sys = ODESystem(eqs,t,[x,y,z],[σ,ρ,β]; differencevars=[y])Producing the ODEProblem and the callback
prob = ODEProblem(sys,u0,tspan,p,jac=true)
difference_cb = generate_difference_cb(sys)Mention the callback while solving the problem:
solve(prob, Rodas5(); cb=difference_cb)@ChrisRackauckas @YingboMa
Does this kind of workflow seem reasonable to begin with?
OR do we want more automation that might involve API changes?
OR did you have something else in mind?