@@ -13,7 +13,6 @@ using Test
13
13
@test prob === nothing
14
14
end
15
15
16
-
17
16
import HomotopyContinuation
18
17
19
18
@testset " No parameters" begin
@@ -22,12 +21,19 @@ import HomotopyContinuation
22
21
0 ~ x^ 2 + 4 x + 4
23
22
0 ~ y * z + 4 x^ 2 ]
24
23
@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)
26
26
@test prob[x] == prob[y] == prob[z] == 1.0
27
27
@test prob[x + y] == 2.0
28
28
sol = solve (prob; threading = false )
29
29
@test SciMLBase. successful_retcode (sol)
30
30
@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
31
37
end
32
38
33
39
struct Wrapper
92
98
" Exponent" , " not an integer" , " not a polynomial" ] HomotopyContinuationProblem (
93
99
sys, [])
94
100
@test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
101
+ @test NonlinearProblem (sys, []) isa NonlinearProblem
102
+
95
103
@mtkbuild sys = NonlinearSystem ([x^ x - x ~ 0 ])
96
104
@test_throws [" Cannot convert" , " Unable" , " symbolically solve" ,
97
105
" Exponent" , " unknowns" , " not a polynomial" ] HomotopyContinuationProblem (
98
106
sys, [])
99
107
@test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
108
+ @test NonlinearProblem (sys, []) isa NonlinearProblem
100
109
@mtkbuild sys = NonlinearSystem ([((x^ 2 ) / sin (x))^ 2 + x ~ 0 ])
101
110
@test_throws [" Cannot convert" , " both polynomial" , " non-polynomial" ,
102
111
" recognized" , " sin" , " not a polynomial" ] HomotopyContinuationProblem (
103
112
sys, [])
104
113
@test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
114
+ @test NonlinearProblem (sys, []) isa NonlinearProblem
105
115
106
116
@variables y = 2.0
107
117
@mtkbuild sys = NonlinearSystem ([x^ 2 + y^ 2 + 2 ~ 0 , y ~ sin (x)])
108
118
@test_throws [" Cannot convert" , " recognized" , " sin" , " not a polynomial" ] HomotopyContinuationProblem (
109
119
sys, [])
110
120
@test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
121
+ @test NonlinearProblem (sys, []) isa NonlinearProblem
111
122
112
123
@mtkbuild sys = NonlinearSystem ([x^ 2 + y^ 2 - 2 ~ 0 , sin (x + y) ~ 0 ])
113
124
@test_throws [" Cannot convert" , " function of multiple unknowns" ] HomotopyContinuationProblem (
114
125
sys, [])
115
126
@test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
127
+ @test NonlinearProblem (sys, []) isa NonlinearProblem
116
128
117
129
@mtkbuild sys = NonlinearSystem ([sin (x)^ 2 + 1 ~ 0 , cos (y) - cos (x) - 1 ~ 0 ])
118
130
@test_throws [" Cannot convert" , " multiple non-polynomial terms" , " same unknown" ] HomotopyContinuationProblem (
119
131
sys, [])
120
132
@test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
133
+ @test NonlinearProblem (sys, []) isa NonlinearProblem
121
134
122
135
@mtkbuild sys = NonlinearSystem ([sin (x^ 2 )^ 2 + sin (x^ 2 ) - 1 ~ 0 ])
123
136
@test_throws [" import Nemo" ] HomotopyContinuationProblem (sys, [])
124
137
@test MTK. safe_HomotopyContinuationProblem (sys, []) isa MTK. NotPolynomialError
138
+ @test NonlinearProblem (sys, []) isa NonlinearProblem
125
139
end
126
140
127
141
import Nemo
0 commit comments