@@ -32,14 +32,16 @@ function is_polynomial(x, wrt)
32
32
end
33
33
if operation (x) == (^ )
34
34
b, p = arguments (x)
35
- is_pow_integer = symtype (p) <: Integer
36
- if ! is_pow_integer
37
- if symbolic_type (p) == NotSymbolic ()
38
- @warn " In $x : Exponent $p is not an integer"
39
- else
40
- @warn " In $x : Exponent $p is not an integer. Use `@parameters p::Integer` to declare integer parameters."
41
- end
35
+ if symbolic_type (p) != NotSymbolic ()
36
+ @warn " In $x : Exponent $p cannot be symbolic"
37
+ is_pow_integer = false
38
+ elseif ! (p isa Integer)
39
+ @warn " In $x : Exponent $p is not an integer"
40
+ is_pow_integer = false
41
+ else
42
+ is_pow_integer = true
42
43
end
44
+
43
45
exponent_has_unknowns = contains_variable (p, wrt)
44
46
if exponent_has_unknowns
45
47
@warn " In $x : Exponent $p cannot contain unknowns of the system."
@@ -179,6 +181,8 @@ Create a `HomotopyContinuationProblem` from a `NonlinearSystem` with polynomial
179
181
The problem will be solved by HomotopyContinuation.jl. The resultant `NonlinearSolution`
180
182
will contain the polynomial root closest to the point specified by `u0map` (if real roots
181
183
exist for the system).
184
+
185
+ Keyword arguments are forwarded to `HomotopyContinuation.solver_startsystems`.
182
186
"""
183
187
function MTK. HomotopyContinuationProblem (
184
188
sys:: NonlinearSystem , u0map, parammap = nothing ; eval_expression = false ,
@@ -223,29 +227,33 @@ function MTK.HomotopyContinuationProblem(
223
227
224
228
obsfn = MTK. ObservedFunctionCache (sys; eval_expression, eval_module)
225
229
226
- return MTK. HomotopyContinuationProblem (u0, mtkhsys, denominator, sys, obsfn)
230
+ solver_and_starts = HomotopyContinuation. solver_startsolutions (mtkhsys; kwargs... )
231
+ return MTK. HomotopyContinuationProblem (
232
+ u0, mtkhsys, denominator, sys, obsfn, solver_and_starts)
227
233
end
228
234
229
235
"""
230
236
$(TYPEDSIGNATURES)
231
237
232
238
Solve a `HomotopyContinuationProblem`. Ignores the algorithm passed to it, and always
233
- uses `HomotopyContinuation.jl`. All keyword arguments except the ones listed below are
234
- forwarded to `HomotopyContinuation.solve`. The original solution as returned by
239
+ uses `HomotopyContinuation.jl`. The original solution as returned by
235
240
`HomotopyContinuation.jl` will be available in the `.original` field of the returned
236
241
`NonlinearSolution`.
237
242
238
- All keyword arguments have their default values in HomotopyContinuation.jl, except
239
- `show_progress` which defaults to `false`.
243
+ All keyword arguments except the ones listed below are forwarded to
244
+ `HomotopyContinuation.solve`. Note that the solver and start solutions are precomputed,
245
+ and only keyword arguments related to the solve process are valid. All keyword
246
+ arguments have their default values in HomotopyContinuation.jl, except `show_progress`
247
+ which defaults to `false`.
240
248
241
249
Extra keyword arguments:
242
250
- `denominator_abstol`: In case `prob` is solving a rational function, roots which cause
243
251
the denominator to be below `denominator_abstol` will be discarded.
244
252
"""
245
253
function CommonSolve. solve (prob:: MTK.HomotopyContinuationProblem ,
246
254
alg = nothing ; show_progress = false , denominator_abstol = 1e-7 , kwargs... )
247
- sol = HomotopyContinuation . solve (
248
- prob . homotopy_continuation_system ; show_progress, kwargs... )
255
+ solver, starts = prob . solver_and_starts
256
+ sol = HomotopyContinuation . solve (solver, starts ; show_progress, kwargs... )
249
257
realsols = HomotopyContinuation. results (sol; only_real = true )
250
258
if isempty (realsols)
251
259
u = state_values (prob)
0 commit comments