Skip to content

Commit cd0a5bf

Browse files
add a test
1 parent 2b5b014 commit cd0a5bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/nonlinearsystem.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using ModelingToolkit, StaticArrays, LinearAlgebra
22
using DiffEqBase, SparseArrays
33
using Test
4+
using NonlinearSolve
45
using ModelingToolkit: value
56

67
canonequal(a, b) = isequal(simplify(a), simplify(b))
@@ -62,9 +63,14 @@ eqs = [0 ~ σ*a,
6263
0 ~ x*y - β*z]
6364
ns = NonlinearSystem(eqs, [x,y,z], [σ,ρ,β])
6465
nlsys_func = generate_function(ns, [x,y,z], [σ,ρ,β])
66+
nf = NonlinearFunction(ns)
6567
jac = calculate_jacobian(ns)
6668

6769
@test ModelingToolkit.jacobian_sparsity(ns).colptr == sparse(jac).colptr
6870
@test ModelingToolkit.jacobian_sparsity(ns).rowval == sparse(jac).rowval
6971

7072
jac = generate_jacobian(ns)
73+
74+
prob = NonlinearProblem(ns,ones(3),ones(3))
75+
sol = solve(prob,NewtonRaphson())
76+
@test sol.u[1] sol.u[2]

0 commit comments

Comments
 (0)