I am defining two ODEProblems, where they are both the same but the implementation is different. There is a parameter I specify for one problem directly inside the function and for the other problem as an argument to the function.
function decay1(dx,x,t,p)
dx[1] = -p[1]*x[1]*0.04*0.00127
end
function decay2(dx,x,t,p)
dx[1] = -1574*x[1]*0.04*0.00127
end
prob1 = ODEProblem(decay1, [0.25], (0.,8.), [1574])
prob2 = ODEProblem(decay1, [0.25], (0.,8.))
2.0[1] works, which is why the code didn’t error when indexing the scalar for time. For reference, this is the corrected code with @larsm and @karajan’s corrections:
function decay1(dx,x,p,t)
dx[1] = -p[1]*x[1]*0.04*0.00127
end
function decay2(dx,x,p,t)
dx[1] = -1574*x[1]*0.04*0.00127
end
prob1 = ODEProblem(decay1, [0.25], (0.,8.), [1574])
prob2 = ODEProblem(decay2, [0.25], (0.,8.))