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

Include remake in example for ODEProblem #488

Open
nonsciencemark opened this issue Sep 6, 2023 · 4 comments
Open

Include remake in example for ODEProblem #488

nonsciencemark opened this issue Sep 6, 2023 · 4 comments

Comments

@nonsciencemark
Copy link

nonsciencemark commented Sep 6, 2023

Adding four lines for remake of ODEProblem would save new users a lot of time remaking the same ODE while changing parameters e.g.,

using SciMLBase
function lorenz!(du,u,p,t)
  du[1] = 10.0(u[2]-u[1])
  du[2] = u[1]*(28.0-u[3]) - u[2]
  du[3] = u[1]*u[2] - (8/3)*u[3]
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,100.0)
prob = ODEProblem(lorenz!,u0,tspan)
  
# Test that it worked
using OrdinaryDiffEq
sol = solve(prob,Tsit5())
using Plots; plot(sol,vars=(1,2,3))

# Try with new u0 and tspan
prob = remake(prob; u0 = [2.0;0.0;0.0], tspan = (0.0,50.0))
sol = solve(prob,Tsit5())
using Plots; plot(sol,vars=(1,2,3))
@nonsciencemark nonsciencemark changed the title Include remake in example for `ODEProblem Include remake in example for ODEProblem Sep 6, 2023
@ChrisRackauckas
Copy link
Member

I think it's reasonable. You mean add it to the first tutorial?

@nonsciencemark
Copy link
Author

Yes. I think that examples of remake like above would be useful in in the first tutorial as well as in line 82 in the source so that it's visible with ?ODEProblem1.

There are also cases in the problem library which ?ODEProblem leads to that create new ODEProblems instead of using remake.

Also the part of the FAQ that mentions this functionality could be renamed so that it is more easily findable. Not sure what synonyms would be appropriate but searching e.g., "update/change/modify parameters/state/tspan" don't seem to get you to this information.

Footnotes

  1. maybe this would lead to bloat creep, but it does already have plot

@ChrisRackauckas
Copy link
Member

100% agreed.

There are also cases in the problem library which ?ODEProblem leads to that create new ODEProblems instead of using remake.

It would be good to get an issue open there. Those cases were probably just implemented before remake was created, so it was never updated.

Also the part of the FAQ that mentions this functionality could be renamed so that it is more easily findable. Not sure what synonyms would be appropriate but searching e.g., "update/change/modify parameters/state/tspan" don't seem to get you to this information.

"Updating or modifying states and parameters of an already built problem" ?

@nonsciencemark
Copy link
Author

"Updating or modifying states and parameters of an already built problem"

I think that would be better, yes.

It would be good to get an issue open there

Will open a new issue over there when I have a bit of time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants