|
26 | 26 | eqs = [0 ~ σ * (y - x) * h, |
27 | 27 | 0 ~ x * (ρ - z) - y, |
28 | 28 | 0 ~ x * y - β * z] |
29 | | -@named ns = System(eqs, [x, y, z], [σ, ρ, β], defaults = Dict(x => 2)) |
| 29 | +@named ns = System(eqs, [x, y, z], [σ, ρ, β, h], defaults = Dict(x => 2)) |
30 | 30 | @test eval(toexpr(ns)) == ns |
31 | | -test_nlsys_inference("standard", ns, (x, y, z), (σ, ρ, β)) |
| 31 | +test_nlsys_inference("standard", ns, (x, y, z), (σ, ρ, β, h)) |
32 | 32 | @test begin |
33 | | - f = generate_rhs(ns, [x, y, z], [σ, ρ, β], expression = Val{false})[2] |
| 33 | + f = generate_rhs(ns, [x, y, z], [σ, ρ, β, h], expression = Val{false})[2] |
34 | 34 | du = [0.0, 0.0, 0.0] |
35 | | - f(du, [1, 2, 3], [1, 2, 3]) |
| 35 | + f(du, [1, 2, 3], [1, 2, 3, 1]) |
36 | 36 | du ≈ [1, -3, -7] |
37 | 37 | end |
38 | 38 |
|
@@ -64,9 +64,9 @@ a = y - x |
64 | 64 | eqs = [0 ~ σ * a * h, |
65 | 65 | 0 ~ x * (ρ - z) - y, |
66 | 66 | 0 ~ x * y - β * z] |
67 | | -@named ns = System(eqs, [x, y, z], [σ, ρ, β]) |
| 67 | +@named ns = System(eqs, [x, y, z], [σ, ρ, β, h]) |
68 | 68 | ns = complete(ns) |
69 | | -nlsys_func = generate_rhs(ns, [x, y, z], [σ, ρ, β]) |
| 69 | +nlsys_func = generate_rhs(ns, [x, y, z], [σ, ρ, β, h]) |
70 | 70 | nf = NonlinearFunction(ns) |
71 | 71 | jac = calculate_jacobian(ns) |
72 | 72 |
|
@@ -99,7 +99,7 @@ eqs1 = [ |
99 | 99 | 0 ~ x + y - z - u |
100 | 100 | ] |
101 | 101 |
|
102 | | -lorenz = name -> System(eqs1, [x, y, z, u, F], [σ, ρ, β], name = name) |
| 102 | +lorenz = name -> System(eqs1, [x, y, z, u, F], [σ, ρ, β, h], name = name) |
103 | 103 | lorenz1 = lorenz(:lorenz1) |
104 | 104 | @test_throws ArgumentError NonlinearProblem(complete(lorenz1), zeros(5), zeros(3)) |
105 | 105 | lorenz2 = lorenz(:lorenz2) |
@@ -132,7 +132,7 @@ sol = solve(prob, FBDF(), reltol = 1e-7, abstol = 1e-7) |
132 | 132 | eqs = [0 ~ σ * (y - x), |
133 | 133 | 0 ~ x * (ρ - z) - y, |
134 | 134 | 0 ~ x * y - β * z * h] |
135 | | -@named ns = System(eqs, [x, y, z], [σ, ρ, β]) |
| 135 | +@named ns = System(eqs, [x, y, z], [σ, ρ, β, h]) |
136 | 136 | np = NonlinearProblem( |
137 | 137 | complete(ns), [0, 0, 0], [σ => 1, ρ => 2, β => 3], jac = true, sparse = true) |
138 | 138 | @test calculate_jacobian(ns, sparse = true) isa SparseMatrixCSC |
@@ -214,7 +214,7 @@ testdict = Dict([:test => 1]) |
214 | 214 | eqs = [0 ~ a * (y - x) * h, |
215 | 215 | 0 ~ x * (b - z) - y, |
216 | 216 | 0 ~ x * y - c * z] |
217 | | - @named sys = System(eqs, [x, y, z], [a, b, c], defaults = Dict(x => 2.0)) |
| 217 | + @named sys = System(eqs, [x, y, z], [a, b, c, h], defaults = Dict(x => 2.0)) |
218 | 218 | sys = complete(sys) |
219 | 219 | prob = NonlinearProblem(sys, ones(length(unknowns(sys)))) |
220 | 220 |
|
|
0 commit comments