# Results

A call to `solve`

returns a `Result`

:

`HomotopyContinuation.Result`

— Type`Result`

The result of `solve`

. This is a wrapper around the results of each single path (`PathResult`

) and it contains some additional information like a random seed to replicate the result.

`HomotopyContinuation.seed`

— Method`seed(::Result)`

Returns the seed to replicate the result.

`HomotopyContinuation.path_results`

— Method`path_results(::Result)`

Returns the stored `PathResult`

s.

## Filtering results and solutions

`HomotopyContinuation.results`

— Function```
results(
result;
only_real = false,
real_tol = 1e-6,
only_nonsingular = false,
only_singular = false,
only_finite = true,
multiple_results = false,
)
results(f, result; options...)
```

Return all `PathResult`

s for which satisfy the given conditions and apply, if provided, the function `f`

.

`results(result::MonodromyResult)`

Returns the computed `PathResult`

s.

`results(W::WitnessSet)`

Get the results stored in `W`

.

`HomotopyContinuation.solutions`

— Function`solutions(result; only_nonsingular = true, conditions...)`

Returns all solutions for which the given conditions apply, see `results`

for the possible conditions.

**Example**

```
julia> @var x y
julia> F = System([(x-2)y, y+x+3]);
julia> solutions(solve(F))
2-element Array{Array{Complex{Float64},1},1}:
[2.0 + 0.0im, -5.0 + 0.0im]
[-3.0 + 0.0im, 0.0 + 0.0im]
```

`solutions(result::MonodromyResult)`

Return all solutions.

`solutions(W::WitnessSet)`

Get the solutions stored in `W`

.

`Base.real`

— Method`real(result, tol=1e-6)`

Get all results where the solutions are real with the given tolerance `tol`

. See `is_real`

for details regarding the determination of 'realness'.

`HomotopyContinuation.real_solutions`

— Function`real_solutions(result; tol=1e-6, conditions...)`

Return all real solution for which the given conditions apply. For the possible `conditions`

see `results`

. Note that `only_real`

is always `true`

and `real_tol`

is now `tol`

.

**Example**

```
julia> @var x y;
julia> F = System([(x-2)y, y+x+3]);
julia> real_solutions(solve(F))
2-element Array{Array{Float64,1},1}:
[2.0, -5.0]
[-3.0, 0.0]
```

`HomotopyContinuation.nonsingular`

— Function`nonsingular(result; conditions...)`

Return all `PathResult`

s for which the solution is non-singular. This is just a shorthand for `results(R; only_nonsingular=true, conditions...)`

. For the possible `conditions`

see `results`

.

`HomotopyContinuation.singular`

— Function`singular(result; multiple_results=false, kwargs...)`

Return all [`PathResult`

]s for which the solution is singular. If `multiple_results=false`

only one point from each cluster of multiple solutions is returned. If `multiple_results = true`

all singular solutions in `R`

are returned. For the possible `kwargs`

see `results`

.

`HomotopyContinuation.at_infinity`

— Function`at_infinity(result)`

Get all results where the solutions is at infinity.

`HomotopyContinuation.failed`

— Function`failed(result)`

Get all results where the path tracking failed.

## Counting

`HomotopyContinuation.nresults`

— Function```
nresults(
result;
only_real = false,
real_tol = 1e-6,
only_nonsingular = false,
only_singular = false,
only_finite = true,
multiple_results = false,
)
```

Count the number of results which satisfy the corresponding conditions. See also `results`

.

`nresults(result::MonodromyResult)`

Returns the number of results computed.

`HomotopyContinuation.nsolutions`

— Function`nsolutions(result; only_nonsingular = true, options...)`

The number of solutions. See `results`

for the possible options.

`nsolutions(result::MonodromyResult)`

Returns the number solutions of the `result`

.

`HomotopyContinuation.nreal`

— Function`nreal(result; tol=1e-6)`

The number of real solutions. See also `is_real`

.

`HomotopyContinuation.nnonsingular`

— Function`nnonsingular(result)`

The number of non-singular solutions. See also `is_singular`

.

`HomotopyContinuation.nsingular`

— Function```
nsingular(
result;
counting_multiplicities = false,
kwargs...,
)
```

The number of singular solutions. A solution is considered singular if its winding number is larger than 1 or the condition number is larger than `tol`

. If `counting_multiplicities=true`

the number of singular solutions times their multiplicities is returned.

`HomotopyContinuation.nat_infinity`

— Function`nat_infinity(result)`

The number of solutions at infinity.

`HomotopyContinuation.nexcess_solutions`

— Function`nexcess_solutions(result)`

The number of exess solutions. See also `excess_solution_check`

.

`HomotopyContinuation.nfailed`

— Function`nfailed(result)`

The number of failed paths.

## PathResult

`HomotopyContinuation.PathResult`

— Type`PathResult`

A `PathResult`

is the result of tracking of a path with `track`

using an `AbstractPathTracker`

( e.g. `EndgameTracker`

)

**Fields**

General solution information:

`return_code`

: See the list of return codes below.`solution::V`

: The solution vector.`t::Float64`

: The value of`t`

at which`solution`

was computed. Note that if`return_code`

is`:at_infinity`

, then`t`

is the value when this was decided.`accuracy::Float64`

: An estimate the (relative) accuracy of the computed solution.`residual::Float64`

: The infinity norm of`H(solution,t)`

.`condition_jacobian::Float64`

: This is the condition number of the Jacobian at the solution. A high condition number indicates a singular solution or a solution on a positive dimensional component.`singular::Bool`

: Whether the solution is considered singular.`winding_number:Union{Nothing, Int}`

: The computed winding number. This is a lower bound on the multiplicity of the solution. It is $nothing$ if the Cauchy endgame was not used.`extended_precision::Bool`

: Indicate whether extended precision is necessary to achieve the accuracy of the`solution`

.`path_number::Union{Nothing,Int}`

: The number of the path (optional).`start_solution::Union{Nothing,V}`

: The start solution of the path (optional).

Performance information:

`accepted_steps::Int`

: The number of accepted steps during the path tracking.`rejected_steps::Int`

: The number of rejected steps during the path tracking.`extended_precision_used::Bool`

: Indicates whether extended precision was necessary to track the path.

Additional path and solution informations

`valuation::Vector{Float64}`

: An approximation of the valuation of the Puiseux series expansion of $x(t)$.`last_path_point::Tuple{V,Float64}`

: The last pair $(x,t)$ before the solution was computed. If the solution was computed with the Cauchy endgame, then the pair $(x,t)$ can be used to rerun the endgame.

**Return codes**

Possible return codes are:

`:success`

: The`EndgameTracker`

obtained a solution.`:at_infinity`

: The`EndgameTracker`

stopped the tracking of the path since it determined that that path is diverging towards infinity.`:at_zero`

: The`EndgameTracker`

stopped the tracking of the path since it determined that that path has a solution where at least one coordinate is 0. This only happens if the option`zero_is_at_infinity`

is`true`

.`:excess_solution`

: For the solution of the system, the system had to be modified which introduced artificial solutions and this solution is one of them.- various return codes indicating termination of the tracking

`HomotopyContinuation.solution`

— Method`solution(r::PathResult)`

Get the solution of the path.

`HomotopyContinuation.is_success`

— Method`is_success(r::PathResult)`

Checks whether the path is successfull.

`HomotopyContinuation.is_at_infinity`

— Method`is_at_infinity(r::PathResult)`

Checks whether the path goes to infinity.

`HomotopyContinuation.is_excess_solution`

— Method`is_excess_solution(r::PathResult)`

Checks whether gives an excess solution that was artificially introduced by the homotopy continuation from the modified system.

`HomotopyContinuation.is_failed`

— Method`is_failed(r::PathResult)`

Checks whether the path failed.

`HomotopyContinuation.is_finite`

— Method`is_finite(r::PathResult)`

Checks whether the path result is finite.

`HomotopyContinuation.is_singular`

— Method`is_singular(r::PathResult)`

Checks whether the path result `r`

is singular.

`HomotopyContinuation.is_nonsingular`

— Method`is_nonsingular(r::PathResult)`

Checks whether the path result is non-singular. This is true if it is not singular.

`HomotopyContinuation.is_real`

— Method`is_real(r::PathResult; tol::Float64 = 1e-6)`

We consider a result as `real`

if the infinity-norm of the imaginary part of the solution is at most `tol`

.

`HomotopyContinuation.accuracy`

— Method`accuracy(r::PathResult)`

Get the accuracy of the solution. This is an estimate of the (relative) distance to the true solution.

`HomotopyContinuation.residual`

— Method`residual(r::PathResult)`

Get the residual of the solution.

`HomotopyContinuation.steps`

— Method`steps(r::PathResult)`

Total number of steps the path tracker performed.

`HomotopyContinuation.accepted_steps`

— Method`accepted_steps(r::PathResult)`

Total number of steps the path tracker accepted.

`HomotopyContinuation.rejected_steps`

— Method`rejected_steps(r::PathResult)`

Total number of steps the path tracker rejected.

`HomotopyContinuation.winding_number`

— Method`winding_number(r::PathResult)`

Get the winding number of the solution of the path. Returns `nothing`

if it wasn't computed.

`HomotopyContinuation.path_number`

— Method`path_number(r::PathResult)`

Get the number of the path. Returns `nothing`

if it wasn't provided.

`HomotopyContinuation.start_solution`

— Method`start_solution(r::PathResult)`

Get the start solution of the path.

`HomotopyContinuation.multiplicity`

— Method`multiplicity(r::PathResult)`

Get the multiplicity of the solution of the path.

`HomotopyContinuation.last_path_point`

— Method`last_path_point(r::PathResult)`

Returns a tuple `(x,t)`

containing the last zero of `H(x, t)`

before the Cauchy endgame was used. Returns `nothing`

if the endgame strategy was not invoked.

`HomotopyContinuation.valuation`

— Method`valuation(r::PathResult)`

Get the computed valuation of the path.