This looks tricky. I though I had a solution, but it fails in a place I don’t know how to fix with ERROR: Differentiation with array expressions is not yet supported
.
The new error
julia> system = structural_simplify(system)
ERROR: Differentiation with array expressions is not yet supported
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] occursin_info
@ ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:59 [inlined]
[3] (::Symbolics.var"#210#212"{Term{Real, Nothing}, Term{Real, Nothing}})(a::CubicSpline{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Vector{Float64}, Vector{Float64}, true, Float64})
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:92
[4] iterate
@ ./generator.jl:47 [inlined]
[5] _collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, Symbolics.var"#210#212"{Term{Real, Nothing}, Term{Real, Nothing}}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
@ Base ./array.jl:807
[6] collect_similar(cont::Vector{Any}, itr::Base.Generator{Vector{Any}, Symbolics.var"#210#212"{Term{Real, Nothing}, Term{Real, Nothing}}})
@ Base ./array.jl:716
[7] map(f::Function, A::Vector{Any})
@ Base ./abstractarray.jl:2933
[8] occursin_info(x::Term{Real, Nothing}, expr::Term{Real, Nothing}, fail::Bool)
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:92
[9] (::Symbolics.var"#210#212"{Term{Real, Nothing}, SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing}})(a::Term{Real, Nothing})
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:92
[10] iterate
@ ./generator.jl:47 [inlined]
[11] collect_to!(dest::Vector{Term{Real, Nothing}}, itr::Base.Generator{Vector{SymbolicUtils.Symbolic{Real}}, Symbolics.var"#210#212"{Term{Real, Nothing}, SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing}}}, offs::Int64, st::Int64)
@ Base ./array.jl:845
[12] collect_to_with_first!(dest::Vector{Term{Real, Nothing}}, v1::Term{Real, Nothing}, itr::Base.Generator{Vector{SymbolicUtils.Symbolic{Real}}, Symbolics.var"#210#212"{Term{Real, Nothing}, SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing}}}, st::Int64)
@ Base ./array.jl:823
[13] _collect(c::Vector{SymbolicUtils.Symbolic{Real}}, itr::Base.Generator{Vector{SymbolicUtils.Symbolic{Real}}, Symbolics.var"#210#212"{Term{Real, Nothing}, SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing}}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
@ Base ./array.jl:817
[14] collect_similar(cont::Vector{SymbolicUtils.Symbolic{Real}}, itr::Base.Generator{Vector{SymbolicUtils.Symbolic{Real}}, Symbolics.var"#210#212"{Term{Real, Nothing}, SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing}}})
@ Base ./array.jl:716
[15] map(f::Function, A::Vector{SymbolicUtils.Symbolic{Real}})
@ Base ./abstractarray.jl:2933
[16] occursin_info(x::Term{Real, Nothing}, expr::SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing}, fail::Bool)
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:92
[17] occursin_info(x::Term{Real, Nothing}, expr::SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing})
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:57
[18] expand_derivatives(O::Term{Real, Nothing}, simplify::Bool; occurances::Nothing)
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:169
[19] expand_derivatives(O::Term{Real, Nothing}, simplify::Bool)
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:163
[20] jacobian(ops::Vector{SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing}}, vars::Vector{Any}; simplify::Bool)
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:443
[21] jacobian(ops::Vector{SymbolicUtils.Add{Real, Int64, Dict{Any, Number}, Nothing}}, vars::Vector{Any})
@ Symbolics ~/.julia/packages/Symbolics/UrqtQ/src/diff.jl:440
[22] (::ModelingToolkit.StructuralTransformations.var"#141#144"{TearingState{ODESystem}})(eqs::Vector{Int64}, vars::Vector{Int64})
@ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/jCQlF/src/structural_transformation/symbolics_tearing.jl:729
[23] dummy_derivative_graph!(structure::SystemStructure, var_eq_matching::ModelingToolkit.BipartiteGraphs.Matching{ModelingToolkit.BipartiteGraphs.Unassigned, Vector{Union{ModelingToolkit.BipartiteGraphs.Unassigned, Int64}}}, jac::ModelingToolkit.StructuralTransformations.var"#141#144"{TearingState{ODESystem}}, ::Tuple{ModelingToolkit.AliasGraph, Nothing}, state_priority::Function)
@ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/jCQlF/src/structural_transformation/partial_state_selection.jl:220
[24] dummy_derivative_graph!(state::TearingState{ODESystem}, jac::Function, ::Tuple{ModelingToolkit.AliasGraph, Nothing}; state_priority::Function, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/jCQlF/src/structural_transformation/partial_state_selection.jl:159
[25] dummy_derivative(sys::ODESystem, state::TearingState{ODESystem}, ag::ModelingToolkit.AliasGraph; simplify::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/jCQlF/src/structural_transformation/symbolics_tearing.jl:747
[26] _structural_simplify!(state::TearingState{ODESystem}, io::Nothing; simplify::Bool, check_consistency::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit.SystemStructures ~/.julia/packages/ModelingToolkit/jCQlF/src/systems/systemstructure.jl:542
[27] structural_simplify!(state::TearingState{ODESystem}, io::Nothing; simplify::Bool, check_consistency::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit.SystemStructures ~/.julia/packages/ModelingToolkit/jCQlF/src/systems/systemstructure.jl:496
[28] structural_simplify(sys::ODESystem, io::Nothing; simplify::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/jCQlF/src/systems/systems.jl:39
[29] structural_simplify (repeats 2 times)
@ ~/.julia/packages/ModelingToolkit/jCQlF/src/systems/systems.jl:19 [inlined]
[30] top-level scope
@ REPL[51]:1