I am trying to define a callback to modify the scalar state of an ODE but I get an error. Here is a simple code that reproduces this:
(v0.7) pkg> st
Status `~/.julia/environments/v0.7/Project.toml`
[0c46a032] DifferentialEquations v5.2.0
[4076af6c] JuMP v0.18.2+ #master (https://github.com/JuliaOpt/JuMP.jl.git)
[76087f3c] NLopt v0.5.0
[91a5bcdd] Plots v0.19.2
[89212889] ReverseDiffSparse v0.8.1+ #master (https://github.com/mlubin/ReverseDiffSparse.jl.git)
julia> using DifferentialEquations
julia> f(u,p,t)=1.0
f (generic function with 1 method)
julia> u0=0.0
0.0
julia> tspan=(0.0,10.0)
(0.0, 10.0)
julia> prob = ODEProblem(f,u0,tspan)
ODEProblem with uType Float64 and tType Float64. In-place: false
timespan: (0.0, 10.0)
u0: 0.0
julia> solve(prob,callback=ContinuousCallback((u,t,integrator)->t-1.0,integrator-> integrator.u+=1.0 ))
I can run the examples in the doc but they are for event detection using vector ODE. What can I change to make it work with scalar ODE (without switching to size-1 vectors )?
Thank you