@@ -13,7 +13,6 @@ using Test
1313 @test prob === nothing
1414end
1515
16-
1716import HomotopyContinuation
1817
1918@testset " No parameters" begin
@@ -22,12 +21,19 @@ import HomotopyContinuation
2221 0 ~ x^ 2 + 4 x + 4
2322 0 ~ y * z + 4 x^ 2 ]
2423 @mtkbuild sys = NonlinearSystem (eqs)
25- prob = HomotopyContinuationProblem (sys, [x => 1.0 , y => 1.0 , z => 1.0 ], [])
24+ u0 = [x => 1.0 , y => 1.0 , z => 1.0 ]
25+ prob = HomotopyContinuationProblem (sys, u0)
2626 @test prob[x] == prob[y] == prob[z] == 1.0
2727 @test prob[x + y] == 2.0
2828 sol = solve (prob; threading = false )
2929 @test SciMLBase. successful_retcode (sol)
3030 @test norm (sol. resid)≈ 0.0 atol= 1e-10
31+
32+ prob2 = NonlinearProblem (sys, u0)
33+ @test prob2 isa HomotopyContinuationProblem
34+ sol = solve (prob2; threading = false )
35+ @test SciMLBase. successful_retcode (sol)
36+ @test norm (sol. resid)≈ 0.0 atol= 1e-10
3137end
3238
3339struct Wrapper
9298 " Exponent" , " not an integer" , " not a polynomial" ] HomotopyContinuationProblem (
9399 sys, [])
94100 @test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
101+ @test NonlinearProblem (sys, []) isa NonlinearProblem
102+
95103 @mtkbuild sys = NonlinearSystem ([x^ x - x ~ 0 ])
96104 @test_throws [" Cannot convert" , " Unable" , " symbolically solve" ,
97105 " Exponent" , " unknowns" , " not a polynomial" ] HomotopyContinuationProblem (
98106 sys, [])
99107 @test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
108+ @test NonlinearProblem (sys, []) isa NonlinearProblem
100109 @mtkbuild sys = NonlinearSystem ([((x^ 2 ) / sin (x))^ 2 + x ~ 0 ])
101110 @test_throws [" Cannot convert" , " both polynomial" , " non-polynomial" ,
102111 " recognized" , " sin" , " not a polynomial" ] HomotopyContinuationProblem (
103112 sys, [])
104113 @test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
114+ @test NonlinearProblem (sys, []) isa NonlinearProblem
105115
106116 @variables y = 2.0
107117 @mtkbuild sys = NonlinearSystem ([x^ 2 + y^ 2 + 2 ~ 0 , y ~ sin (x)])
108118 @test_throws [" Cannot convert" , " recognized" , " sin" , " not a polynomial" ] HomotopyContinuationProblem (
109119 sys, [])
110120 @test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
121+ @test NonlinearProblem (sys, []) isa NonlinearProblem
111122
112123 @mtkbuild sys = NonlinearSystem ([x^ 2 + y^ 2 - 2 ~ 0 , sin (x + y) ~ 0 ])
113124 @test_throws [" Cannot convert" , " function of multiple unknowns" ] HomotopyContinuationProblem (
114125 sys, [])
115126 @test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
127+ @test NonlinearProblem (sys, []) isa NonlinearProblem
116128
117129 @mtkbuild sys = NonlinearSystem ([sin (x)^ 2 + 1 ~ 0 , cos (y) - cos (x) - 1 ~ 0 ])
118130 @test_throws [" Cannot convert" , " multiple non-polynomial terms" , " same unknown" ] HomotopyContinuationProblem (
119131 sys, [])
120132 @test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
133+ @test NonlinearProblem (sys, []) isa NonlinearProblem
121134
122135 @mtkbuild sys = NonlinearSystem ([sin (x^ 2 )^ 2 + sin (x^ 2 ) - 1 ~ 0 ])
123136 @test_throws [" import Nemo" ] HomotopyContinuationProblem (sys, [])
124137 @test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
138+ @test NonlinearProblem (sys, []) isa NonlinearProblem
125139end
126140
127141import Nemo
0 commit comments