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
ils = StateSelection.structural_singularity_removal!(state)
77
88
78
89
s = state.structure
@@ -82,11 +93,35 @@ function structural_transformation!(state::TransformationState)
82
93
end
83
94
state.total_incidence[e] =Incidence(Const(0.), IncidenceVector(MAX_EQS, map(x->x+1, ils.row_cols[ei]), Union{Float64, NonLinear}[Float64(x) for x in ils.row_vals[ei]]))
# This is example (7.30) from Taihei Oki "Computing Valuations of Determinants via Combinatorial Optimization: Applications to Differential Equations".
27
27
# The system is index 4 and requires iterating pantelides/ssm.
28
-
functionssm4()
28
+
functionssrm4()
29
29
x₁ =continuous()
30
30
x₂ =continuous()
31
31
x₃ =continuous()
@@ -37,14 +37,24 @@ function ssm4()
37
37
ẍ₁ =ddt(ẋ₁)
38
38
ẍ₂ =ddt(ẋ₂)
39
39
ẍ₃ =ddt(ẋ₃)
40
-
always!(ẍ₁+ẍ₂-(ẋ₁+ẋ₂)+x₄)
41
-
always!(ẍ₁+ẍ₂+x₃)
40
+
always!((ẍ₁+ẍ₂)-(ẋ₁+ẋ₂)+x₄)
41
+
always!((ẍ₁+ẍ₂)+x₃)
42
42
always!(x₂+ẍ₃+ẋ₄)
43
43
always!(x₃+ẋ₄)
44
44
end
45
45
46
-
ssm4()
46
+
ssrm4()
47
+
# We expect state selection here to pick (x₁, x₄, ẋ₁)
48
+
# The system simplifies to ẍ₁ = ẋ₄ = ẋ₁ - x₄
49
+
init = (1.,0.,1.)
50
+
functionanalytic(init, t)
51
+
c = init[3] - init[2]
52
+
ẋ₁ = init[3] + c*t
53
+
x₄ = init[2] + c*t
54
+
x₁ = init[1] + init[3]*t +1/2*c*t^2
55
+
return (x₁, x₄, ẋ₁)
56
+
end
57
+
sol =solve(DAECProblem(ssrm4, (1,2,3) .=> init), DFBDF(autodiff=false))
0 commit comments