You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using OrdinaryDiffEq, ModelingToolkit, Test
using ModelingToolkit: t_nounits as t, D_nounits as D
@variablesx(t) y(t)
@named sys =ODESystem([
D(x) ~0# unknown
y ~2*x # observed
], t)
sys =structural_simplify(sys)
prob =ODEProblem(sys, [x =>1.0], (0.0, 1.0), [])
sol =solve(prob, Tsit5())
ts =range(0.0, 1.0, length=5)
out =zeros(size(ts))
@testsol(out, ts; idxs=1) ==sol(ts; idxs=1) # passes@testsol(out, ts; idxs=sys.x) ==sol(ts; idxs=sys.x) # RHS works, LHS fails@testsol(out, ts; idxs=sys.y) ==sol(ts; idxs=sys.y) # RHS works, LHS fails
The last two in-place evaluations fail with
ERROR: ArgumentError: invalid index: x(t) of type SymbolicUtils.BasicSymbolic{Real}
ERROR: ArgumentError: invalid index: y(t) of type SymbolicUtils.BasicSymbolic{Real}
The text was updated successfully, but these errors were encountered:
The documentation mentions an inplace function for evaluating a solution, but this does not work with ModelingToolkit:
The last two in-place evaluations fail with
The text was updated successfully, but these errors were encountered: