File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -190,12 +190,35 @@ end
190190function System (eqs:: Vector{Equation} , iv; kwargs... )
191191 iv === nothing && return System (eqs; kwargs... )
192192
193- allunknowns = Set ()
193+ diffvars = OrderedSet ()
194+ othervars = OrderedSet ()
194195 ps = Set ()
196+ diffeqs = Equation[]
197+ othereqs = Equation[]
195198 for eq in eqs
196- collect_vars! (allunknowns, ps, eq, iv)
199+ if ! (eq. lhs isa Union{Symbolic, Number})
200+ push! (othereqs, eq)
201+ continue
202+ end
203+ collect_vars! (othervars, ps, eq, iv)
204+ if operation (eq. lhs) isa Differential
205+ var, _ = var_from_nested_derivative (eq. lhs)
206+ if var in diffvars
207+ throw (ArgumentError ("""
208+ The differential variable $var is not unique in the system of \
209+ equations.
210+ """ ))
211+ end
212+ push! (diffvars, var)
213+ push! (diffeqs, eq)
214+ else
215+ push! (othereqs, eq)
216+ end
197217 end
198218
219+ allunknowns = union (diffvars, othervars)
220+ eqs = [diffeqs; othereqs]
221+
199222 brownians = Set ()
200223 for x in allunknowns
201224 x = unwrap (x)
You can’t perform that action at this time.
0 commit comments