Skip to content

Commit f358076

Browse files
committed
Fix vars
1 parent ba22d8e commit f358076

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/systems/diffeqs/odesystem.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ iv_from_nested_derivative(x::Term) = operation(x) isa Differential ? iv_from_nes
8686
iv_from_nested_derivative(x::Sym) = x
8787
iv_from_nested_derivative(x) = missing
8888

89-
vars(exprs::Term) = vars([exprs])
89+
vars(x::Sym) = [x]
90+
vars(exprs::Symbolic) = vars([exprs])
9091
vars(exprs) = foldl(vars!, exprs; init = Set())
9192
function vars!(vars, O)
9293
isa(O, Sym) && return push!(vars, O)
93-
!isa(O, Term) && return vars
94+
!isa(O, Symbolic) && return vars
9495

9596
operation(O) isa Sym && push!(vars, O)
9697
for arg arguments(O)

test/direct.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ eqs = [σ*(y-x),
1313
x*y - β*z]
1414

1515

16-
simpexpr = Expr[:($(*)(σ, $(-)(y, x))),
17-
:($(-)($(*)(x, $(-)(ρ, z)), y)),
18-
:($(-)($(*)(x, y), $(*)(β, z)))]
16+
simpexpr = Expr[:($(*)(σ, $(+)($(*)(-1, x), y))),
17+
:($(+)($(*)(x, $(+)($(*)(-1, z), ρ)), $(*)(-1, y))),
18+
:($(+)($(*)(x, y), $(*)(-1, z, β)))]
1919

2020
for i in 1:3
2121
@test ModelingToolkit.toexpr.(eqs)[i] == simpexpr[i]

0 commit comments

Comments
 (0)