I am running a two differential equations over a range of parameters, and it works fine. I loop over two parameters (double loop). I would like to know the Julia way of doing this. Here is my code.
Run all α, β pairs
sols = Any
for α ∈ αs
for β ∈ βs
p1 = [α, β, 8., 5.] # α, β, D1, D2
println("α, β= ", α, β)
prob = ODEProblem(coupled!, u0, tspan, p1)
sol = solve(prob, Tsit5())
println("sol: ", size(sol))
append!(sols, [sol]) # <<< NOTICE
Notice the use of “append!”. “sol” is the output to “solve”, and I wish to concatenate the solutions into a Vector of four elements. To do this and properly access the variables, I had to enclose “sol” with brackets. If I do not do this, size(sols) returns 84 instead of 4. I do not quite understand why.
Next step, DiffEqFlux perhaps, which is my ultimate goal for now.
Probably the OP has already considered this himself, and it also depends a bit on his particular purpose, but instead of creating simulations over a parameter grid, it may be more elegant and provide more insight to use a numerical continuation package.
(This is particularly true if you are interested in stability and destabilization of simple invariants such as stationary and periodic solutions.)
Although it overlaps with packages that I am familiar with (AUTO, MATCONT) or involved with (DDE-BIFTOOL), I think it is only fair to point you to PseudoArcLengthContinuation.jl for a project by @rveltz specifically in Julia. Hope, that helps, and enjoy the learning.