Skip to content

Commit 30a8533

Browse files
simplify a bit first
1 parent 4a9a4e2 commit 30a8533

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/systems/diffeqs/abstractodesystem.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function calculate_factorized_W(sys::AbstractODESystem, simplify=true)
5555
isempty(sys.Wfact[]) || return (sys.Wfact[],sys.Wfact_t[])
5656

5757
jac = calculate_jacobian(sys)
58-
gam = Variable(:gam; known = true)()
58+
gam = Variable(gensym(:gamma))()
5959

6060
W = - LinearAlgebra.I + gam*jac
6161
Wfact = lu(W, Val(false), check=false).factors

src/systems/diffeqs/modelingtoolkitize.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function modelingtoolkitize(prob::DiffEqBase.ODEProblem)
99
@parameters t
1010
vars = [Variable(:x, i)(t) for i in eachindex(prob.u0)]
1111
params = prob.p isa DiffEqBase.NullParameters ? [] :
12-
[Variable(,i; known = true)() for i in eachindex(prob.p)]
12+
[Variable(,i)() for i in eachindex(prob.p)]
1313
@derivatives D'~t
1414

1515
rhs = [D(var) for var in vars]
@@ -22,7 +22,7 @@ function modelingtoolkitize(prob::DiffEqBase.ODEProblem)
2222
end
2323

2424
eqs = vcat([rhs[i] ~ lhs[i] for i in eachindex(prob.u0)]...)
25-
de = ODESystem(eqs)
25+
de = ODESystem(eqs,t,vars,params)
2626

2727
de, vars, params
2828
end

test/variable_parsing.jl

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ z1 = Variable(:z)(t)
1717
end
1818
@parameters σ(..)
1919

20-
t1 = Variable(:t; known = true)()
21-
s1 = Variable(:s; known = true)()
22-
σ1 = Variable(; known = true)
20+
t1 = Variable(:t)()
21+
s1 = Variable(:s)()
22+
σ1 = Variable()
2323
@test isequal(t1, t)
2424
@test isequal(s1, s)
2525
@test isequal(σ1, σ)
@@ -42,12 +42,12 @@ convert(Expression, :($x == 0 ? $y : $x))
4242
end
4343
@parameters σ[1:2](..)
4444

45-
t1 = [Variable(:t, 1; known = true)(),
46-
Variable(:t, 2; known = true)()]
47-
s1 = [Variable(:s, 1, 1; known = true)() Variable(:s, 1, 2; known = true)()
48-
Variable(:s, 3, 1; known = true)() Variable(:s, 3, 2; known = true)()]
49-
σ1 = [Variable(, 1; known = true),
50-
Variable(, 2; known = true)]
45+
t1 = [Variable(:t, 1)(),
46+
Variable(:t, 2)()]
47+
s1 = [Variable(:s, 1, 1)() Variable(:s, 1, 2)()
48+
Variable(:s, 3, 1)() Variable(:s, 3, 2)()]
49+
σ1 = [Variable(, 1),
50+
Variable(, 2)]
5151
@test isequal(t1, t)
5252
@test isequal(s1, s)
5353
@test isequal(σ1, σ)

0 commit comments

Comments
 (0)