Hey there,
I am very new to Julia and I am working on an ODE Problem. Basically this is my set-up:
etaspan = (0.0, 1.0) F0 = [1, -1e+10, q_, 0] function eventfcn(vcondition, value, eta, integrator) out[1] = (qmax-F(3)) out[2] = F(2) out[3] = F(4) end function affect!(integrator, idx) if (idx == 1 | idx == 2 | idx == 3) affect!(integrator) = terminate!(integrator) end end cb = VectorContinuousCallback(eventfcn,affect!,3) # odefun(eta,f) will be a vector containing 4 partial derivatives (ODEs), that I # calculate before with the function fnct odefun(eta, f) = fnct(eta, f, r, rho, a, a_, delta, delta_, sigma)[1] # dyn will be a vector containing all dynamic parameters. I also get them through function fnct dyn(eta, f) = fnct(eta, f, r, rho, a, a_, delta, delta_, sigma)[2] QL = 0 QR = 1e+15 for iter = 1:50 F0[4] = (QL+QR)/2 prob = ODEProblem(odefun, F0, etaspan, dyn) sol = solve(prob, Tsit5(), callback = cb, RelTol = 1e-08, abstol = 1e-10) end
However, when trying to run all of this, I get the following error message:
MethodError: no method matching getindex(::typeof(dyn), ::Int64)
As far as I understood, the ODEProblem will at one point call function getindex, but I don’t know why it doesn’t work. Any help would be highly appreciated! <3