The solve function
The solve
function is the most convenient way to solve general polynomial systems. For the mathematical background take a look at our introduction guide.
HomotopyContinuation.solve
— Functionsolve(f; options...)
solve(f, start_solutions; start_parameters, target_parameters, options...)
solve(f, start_solutions; start_subspace, target_subspace, options...)
solve(g, f, start_solutions; options...)
solve(homotopy, start_solutions; options...)
Solve the given problem. If only a single polynomial system f
is given, then all (complex) isolated solutions are computed. If a system f
depending on parameters together with start and target parameters is given then a parameter homotopy is performed. If two systems g
and f
with solutions of g
are given then the solutions are tracked during the deformation of g
to f
. Similarly, for a given homotopy homotopy
$H(x,t)$ with solutions at $t=1$ the solutions at $t=0$ are computed. See the documentation for examples. If the input is a homogeneous polynomial system, solutions on a random affine chart of projective space are computed.
General Options
The solve
routines takes the following options:
catch_interrupt = true
: If this istrue
, the computation is gracefully stopped and a partial result is returned when the computation is interruped.compile = mixed
: Iftrue
then aSystem
(resp.Homotopy
) is compiled to a straight line program (CompiledSystem
resp.CompiledHomotopy
) for evaluation. This induces a compilation overhead. Iffalse
then the generated program is only interpreted (InterpretedSystem
resp.InterpretedHomotopy
). This is slower than the compiled version, but does not introduce compilation overhead.endgame_options
: The options and parameters for the endgame. SeeEndgameOptions
.seed
: The random seed used during the computations. The seed is also reported in the result. For a given random seed the result is always identical.show_progress= true
: Indicate whether a progress bar should be displayed.stop_early_cb
: Here it is possible to provide a function (or any callable struct) which accepts aPathResult
r
as input and returns aBool
. Ifstop_early_cb(r)
istrue
then no further paths are tracked and the computation is finished. This is only called for successfull paths. This is for example useful if you only want to compute one solution of a polynomial system. For thisstop_early_cb = _ -> true
would be sufficient.threading = true
: Enable multi-threading for the computation. The number of available threads is controlled by the environment variableJULIA_NUM_THREADS
.tracker_options
: The options and parameters for the path tracker. SeeTrackerOptions
.
Options depending on input
If only a polynomial system is given:
start_system
: Possible values are:total_degree
and:polyhedral
. Depending on the choice furhter options are possible. See alsototal_degree
andpolyhedral
.
If a system f
depending on parameters together with start parameters (or start subspace), start solutions and multiple target parameters (or target subspaces) then the following options are also available:
flatten
: Flatten the output oftransform_result
. This is useful for example iftransform_result
returns a vector of solutions, and you only want a single vector of solutions as the result (instead of a vector of vector of solutions).transform_parameters = identity
: Transform a parameters valuesp
before passing it totarget_parameters = ...
.transform_result
: A function taking two arguments, theresult
and the parametersp
. By default this returns the tuple(result, p)
.
Basic example
julia> @var x y;
julia> F = System([x^2+y^2+1, 2x+3y-1])
System of length 2
2 variables: x, y
1 + x^2 + y^2
-1 + 2*x + 3*y
julia> solve(F)
Result with 2 solutions
=======================
• 2 non-singular solutions (0 real)
• 0 singular solutions (0 real)
• 2 paths tracked
• random seed: 0x75a6a462
• start_system: :polyhedral
HomotopyContinuation.solver_startsolutions
— Functionsolver_startsolutions(args...; kwargs...)
Takes the same input as solve
but instead of directly solving the problem returns a Solver
struct and the start solutions.
Example
Calling solve(args..; kwargs...)
is equivalent to
solver, starts = solver_startsolutions(args...; kwargs...)
solve(solver, starts)
HomotopyContinuation.Solver
— TypeSolver(path_tracker; seed = nothing)
A struct containing multiple copies of path_tracker
. This contains all pre-allocated data structures to call [solve
]. The most convenient way to construct a Solver
is via solver_startsolutions
.
The function paths_to_track
allows you to know beforehand how manys the you need to track:
HomotopyContinuation.paths_to_track
— Functionpaths_to_track(f; optopms..)
Returns the number of paths tracked when calling solve
with the given arguments.