Pass optional parameters to model in DifferentialEquations.jl

Hello,

I would like to pass optional arguments to a DifferentialEquations.jl ODE model at ODEProblem time. Those optional arguments are meant to alter the model without using the p argument which I would like to save for calibration parameters.
So the model would look like this:


using DifferentialEquations

function model(du,u,p,t ; fixed = [])

### function body  

end;

And I would like to get an ODEProblem which has that fixed parameter set ( e.g. to [1,2,3]). Anyway I can’t get anything like:

problem = ODEProblem(model, u0, t,p; fixed = [1,2,3])

to do what I wish.
Is there a way to accomplish this?

Thanks in advance

1 Like

Just use a closure.

5 Likes

Yes, that worked.

Thank you very much for your amazing libraries and continuous support !

2 Likes