Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Superfluous parameter and initial condition values can be provided to Problems #2779

Open
TorkelE opened this issue Jun 9, 2024 · 1 comment
Labels
question Further information is requested

Comments

@TorkelE
Copy link
Member

TorkelE commented Jun 9, 2024

In this MWE we provide the values of Y and r to the ODEProblem. Since these are not part of the ODESystem, the user have probably done something wrong, and an error should be thrown.

using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D

@parameters p d r
@variables X(t) Y(t)
eqs = [D(X) ~ p - d*X]
@mtkbuild osys = ODESystem(eqs, t)

u0 = [X => 1.0, Y => 1.0]
tspan = (0.0, 100.0)
ps = [p => 1.0, d => 1.0, r => 1.0]

prob = ODEProblem(osys, u0, tspan, ps) # works fine

The values are filtered away in the resulting problem, e.g.

prob[Y]
prob.ps[r]

both yields errors.

the same is the case for the other problem types as well.

@TorkelE
Copy link
Member Author

TorkelE commented Jun 10, 2024

Actually, I should add that this is not as trivial as I first thought. E.g. if you have variables eliminated as observables from MTK, you might still want to provide values for these (e.g. if other parameters/variables have default values depending on these). Hence, there are situations where providing values for superfluous initial conditions might actually make sense.

@ChrisRackauckas ChrisRackauckas added question Further information is requested and removed bug Something isn't working labels Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants