This is fantastic news @shashi ! Thank for the help and attention.
I was able to piece together a workaround based on your recommendations for an MWE and look forward to implementing more complicated functions.
using ModelingToolkit, DifferentialEquations
f(x) = x.*x
#must specify input and output type to register vector
@register_symbolic f(x::Symbolics.Arr{Num,1})::Symbolics.Arr{Num,1}
function g(x)
@syms i::Int
@arrayop (i,) f(x[i]) term = f(x)
end
#testing necessary in-function and ODE workflow
function register_test()
@variables t
D = Differential(t)
@variables y(t)[1:3] = zeros(3)
@variables u(t)[1:3] = zeros(3)
eqs = [
D.(u) .~ ones(3)
#appears we must convert from Symbolics.ArrayOp{Vector{Real}}
#to Symbolics.Arr{Num,1} to do subtraction
#probably do this in g(x) but wanted to look at ArrayOp struct
zeros(3) .~ y - Symbolics.Arr(g(u))
]
structural_simplify(ODESystem(eqs, t, name=:sys))
end
sys = register_test()
prob = ODEProblem(sys, [], (0, 10))
sol = solve(prob, Rodas4(),adaptive=false, dt = 1)
retcode: Success
Interpolation: specialized 3rd order "free" stiffness-aware interpolation
t: 11-element Vector{Float64}:
0.0
1.0
2.0
3.0
4.0
⋮
7.0
8.0
9.0
10.0
u: 11-element Vector{Vector{Float64}}:
[0.0, 0.0, 0.0]
[0.9999999999999991, 0.9999999999999991, 0.9999999999999991]
[1.9999999999999982, 1.9999999999999982, 1.9999999999999982]
[2.9999999999999973, 2.9999999999999973, 2.9999999999999973]
[3.9999999999999964, 3.9999999999999964, 3.9999999999999964]
⋮
[6.999999999999991, 6.999999999999991, 6.999999999999991]
[7.999999999999989, 7.999999999999989, 7.999999999999989]
[8.99999999999999, 8.99999999999999, 8.99999999999999]
[9.999999999999991, 9.999999999999991, 9.999999999999991]
julia> sol[sys.y]
11-element Vector{Vector{Float64}}:
[0.0, 0.0, 0.0]
[0.9999999999999982, 0.9999999999999982, 0.9999999999999982]
[3.999999999999993, 3.999999999999993, 3.999999999999993]
[8.999999999999984, 8.999999999999984, 8.999999999999984]
[15.999999999999972, 15.999999999999972, 15.999999999999972]
⋮
[48.99999999999988, 48.99999999999988, 48.99999999999988]
[63.99999999999983, 63.99999999999983, 63.99999999999983]
[80.99999999999982, 80.99999999999982, 80.99999999999982]
[99.99999999999983, 99.99999999999983, 99.99999999999983]