Skip to content

Commit 510f597

Browse files
mtkitize fixes for non ODE
1 parent 4333c34 commit 510f597

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelingToolkit"
22
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "4.0.3"
4+
version = "4.0.4"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/systems/diffeqs/modelingtoolkitize.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ function modelingtoolkitize(prob::DiffEqBase.SDEProblem)
5252
else
5353
p = prob.p
5454
end
55-
var(x, i) = Sym{FnType{Tuple{symtype(t)}, Real}}(nameof(Variable(:x, i)))
55+
var(x, i) = Num(Sym{FnType{Tuple{symtype(t)}, Real}}(nameof(Variable(x, i))))
5656
vars = reshape([var(:x, i)(value(t)) for i in eachindex(prob.u0)],size(prob.u0))
5757
params = p isa DiffEqBase.NullParameters ? [] :
58-
reshape([Variable(,i) for i in eachindex(p)],size(p))
58+
reshape([Num(Sym{Real}(nameof(Variable(, i)))) for i in eachindex(p)],size(p))
5959

6060
@derivatives D'~t
6161

@@ -102,10 +102,9 @@ function modelingtoolkitize(prob::DiffEqBase.OptimizationProblem)
102102
p = prob.p
103103
end
104104

105-
vars = reshape([Variable(:x, i) for i in eachindex(prob.u0)],size(prob.u0))
105+
vars = reshape([Num(Sym{Real}(nameof(Variable(:x, i)))) for i in eachindex(prob.u0)],size(prob.u0))
106106
params = p isa DiffEqBase.NullParameters ? [] :
107-
reshape([Variable(,i) for i in eachindex(p)],size(Array(p)))
108-
107+
reshape([Num(Sym{Real}(nameof(Variable(, i)))) for i in eachindex(p)],size(Array(p)))
109108

110109
eqs = prob.f(vars, params)
111110
de = OptimizationSystem(eqs,vec(vars),vec(params))

0 commit comments

Comments
 (0)