@@ -32,14 +32,16 @@ function is_polynomial(x, wrt)
3232 end
3333 if operation (x) == (^ )
3434 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
4243 end
44+
4345 exponent_has_unknowns = contains_variable (p, wrt)
4446 if exponent_has_unknowns
4547 @warn " In $x : Exponent $p cannot contain unknowns of the system."
@@ -179,6 +181,8 @@ Create a `HomotopyContinuationProblem` from a `NonlinearSystem` with polynomial
179181The problem will be solved by HomotopyContinuation.jl. The resultant `NonlinearSolution`
180182will contain the polynomial root closest to the point specified by `u0map` (if real roots
181183exist for the system).
184+
185+ Keyword arguments are forwarded to `HomotopyContinuation.solver_startsystems`.
182186"""
183187function MTK. HomotopyContinuationProblem (
184188 sys:: NonlinearSystem , u0map, parammap = nothing ; eval_expression = false ,
@@ -223,29 +227,33 @@ function MTK.HomotopyContinuationProblem(
223227
224228 obsfn = MTK. ObservedFunctionCache (sys; eval_expression, eval_module)
225229
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)
227233end
228234
229235"""
230236$(TYPEDSIGNATURES)
231237
232238Solve 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
235240`HomotopyContinuation.jl` will be available in the `.original` field of the returned
236241`NonlinearSolution`.
237242
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`.
240248
241249Extra keyword arguments:
242250- `denominator_abstol`: In case `prob` is solving a rational function, roots which cause
243251 the denominator to be below `denominator_abstol` will be discarded.
244252"""
245253function CommonSolve. solve (prob:: MTK.HomotopyContinuationProblem ,
246254 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... )
249257 realsols = HomotopyContinuation. results (sol; only_real = true )
250258 if isempty (realsols)
251259 u = state_values (prob)
0 commit comments