You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it seems to me that remake cannot reinitialize a system using defaults that involve the independent parameter (often t). It would be nice if this worked:
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using DifferentialEquations
@variablesx(t) y(t)
@mtkbuild sys =ODESystem([D(x) ~0, D(y) ~0], t; defaults = [y => t])
prob =ODEProblem(sys, unknowns(sys) .=>NaN, (1.0, 2.0), []) # uninitialized problem# I expect one or more (preferably all) of these to initialize y = t = 1.0 from the default
prob1 =remake(prob, use_defaults =true, u0 = [x =>0.0])
prob2 =remake(prob, use_defaults =true, u0 = [x =>0.0], tspan = (1.0, 2.0))
prob3 =remake(prob, use_defaults =true, u0 = [x =>0.0], tspan = (1.0, 2.0), p = [t =>1.0])
All three fail with slightly different error messages.
The text was updated successfully, but these errors were encountered:
hersle
changed the title
Cannot remake problems with defaults involving the independent parameter
Cannot (re)make problems with defaults involving the independent parameter
Jun 25, 2024
More fundamentally, it is not possible to make (not remake) an ODEProblem with defaults involving the independent parameter:
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using DifferentialEquations
@variablesx(t)
@mtkbuild sys =ODESystem([D(x) ~0], t; defaults = [x => t])
prob =ODEProblem(structural_simplify(sys), [], (1.0, 2.0), [])
I should probably have reported this first. I add it here since it is very related.
Currently, it seems to me that
remake
cannot reinitialize a system usingdefaults
that involve the independent parameter (oftent
). It would be nice if this worked:All three fail with slightly different error messages.
The text was updated successfully, but these errors were encountered: