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

Parameter values can be supplied in the initial condition vector #2692

Open
TorkelE opened this issue May 2, 2024 · 2 comments
Open

Parameter values can be supplied in the initial condition vector #2692

TorkelE opened this issue May 2, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented May 2, 2024

MWE:

using ModelingToolkit, OrdinaryDiffEq, Plots

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

u0 = [X => 5.0, d => 0.2]
tspan = (0.0, 10.)
ps = [p => 5.0]
oprob = ODEProblem(osys, u0, tspan, ps)
sol = solve(oprob, Tsit5())
plot(sol)

image

If I then change d, this does have an effect on the result?

u0 = [X => 5.0, d => 0.5]
tspan = (0.0, 10.)
ps = [p => 5.0]
oprob = ODEProblem(osys, u0, tspan, ps)
sol = solve(oprob, Tsit5())
plot(sol)

image

@vyudu
Copy link
Contributor

vyudu commented Jan 10, 2025

Does this need to be fixed? Seems like there's some discussion in #2743 about changing it being too breaking?

@ChrisRackauckas
Copy link
Member

Let's discuss in the Monday chat if this should go into the v10. It would be breaking, yes, but I think it's a good correctness check to add. Either that or we just make the u0 be "all defaults", rather than forcing a split. But I think we should do something for the v10 because this is less than ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants