Skip to content

Commit a5b3ca4

Browse files
committed
Fix steady state syste,s test file.
1 parent e722bed commit a5b3ca4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/steadystatesystems.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using ModelingToolkit
2+
using DifferentialEquations
3+
using Test
4+
5+
@parameters t r
6+
@variables x(t)
7+
@derivatives D'~t
8+
eqs = [D(x) ~ x^2-r]
9+
de = ODESystem(eqs)
10+
11+
for factor in [1e-1, 1e0, 1e10], u0_p in [(2.34,2.676),(22.34,1.632),(.3,15.676),(0.3,0.006)]
12+
u0 = [x => factor*u0_p[1]]
13+
p = [r => factor*u0_p[2]]
14+
ss_prob = SteadyStateProblem(de,u0,p)
15+
sol = solve(ss_prob).u[1]
16+
@test abs(sol^2 - factor*u0_p[2]) < 1e-8
17+
end

0 commit comments

Comments
 (0)