Indexed variables (symbolic arrays) with ModelingToolkit.jl

Viewed 123

I would like use ModelingToolkit.jl to solve large nonlinear systems of equations. Unfortunately, using symbolic arrays with NonlinearSystem gives a method error:

ERROR: MethodError: no method matching hasmetadata(::Vector{Num}, ::Type{Symbolics.VariableDefaultValue})

Is there a way of solving nonlinear equations with indexed variables with ModelingToolkit?

Code example:

using ModelingToolkit, NonlinearSolve
vars = @variables x
@named works = NonlinearSystem([], vars, [])

vars = @variables x[1:3]
@named fails = NonlinearSystem([], vars, [])

eqs = [x[j] ~ j for j ∈ 1:3]
@named also_fails = NonlinearSystem(eqs, vars, [])
1 Answers
Related