I am trying to make an interactive plot of a SIV model using GLMakie. I have created the parameters as observable. I now need to make the parameters to pass to the solver. One is u0
that stores the initial values of the variables. I used to instantiate u0 as a vector/array with vcat. How do I do the same with an observable? I tried with @lift but I got an error:
julia> s0 = 1e5 # default starting amount of naive bacteria
100000.0
julia> i0 = 0 # default starting amount of infected bacteria
0
julia> v0 = 1e5 # default starting amount of phages
100000.0
julia> S0 = Observable(s0)
Observable(100000.0)
julia> I0 = Observable(i0)
Observable(0)
julia> V0 = Observable(v0)
Observable(100000.0)
julia> u0 = vcat(S0, I0, V0)
3-element Vector{Observable}:
Observable(100000.0)
Observable(0)
Observable(100000.0)
julia> U0 = @lift(vcat(S0, I0, V0))
ERROR: Did not find any interpolated observables. Use '$(observable)' to interpolate it into the macro.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] var"@lift"(__source__::LineNumberNode, __module__::Module, exp::Any)
@ Makie ~/.julia/packages/Makie/VRavR/src/interaction/liftmacro.jl:77
[3] eval
@ ./boot.jl:385 [inlined]
[4] eval
@ ./Base.jl:88 [inlined]
[5] repleval(m::Module, code::Expr, ::String)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.73.2/scripts/packages/VSCodeServer/src/repl.jl:229
[6] (::VSCodeServer.var"#110#112"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.73.2/scripts/packages/VSCodeServer/src/repl.jl:192
[7] with_logstate(f::Function, logstate::Any)
@ Base.CoreLogging ./logging.jl:515
[8] with_logger
@ ./logging.jl:627 [inlined]
[9] (::VSCodeServer.var"#109#111"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.73.2/scripts/packages/VSCodeServer/src/repl.jl:193
[10] #invokelatest#2
@ ./essentials.jl:892 [inlined]
[11] invokelatest(::Any)
@ Base ./essentials.jl:889
[12] (::VSCodeServer.var"#62#63")()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.73.2/scripts/packages/VSCodeServer/src/eval.jl:34
julia> U0 = $(vcat(S0, I0, V0))
ERROR: syntax: "$" expression outside quote around REPL[23]:1
Stacktrace:
[1] top-level scope
@ REPL[23]:1
julia> U0 = '$(vcat(S0, I0, V0))'
ERROR: ParseError:
# Error @ REPL[24]:1:7
U0 = '$(vcat(S0, I0, V0))'
# └─────────────────┘ ── character literal contains multiple characters
Stacktrace:
[1] top-level scope
@ none:1
How can I set vectors of observables for ODE solved with DifferentialEquations
?