# Systems

Systems (AbstractSystem) are the basic building blocks of homotopies.

Although they sound similar, AbstractSystems and System share different purposes. AbstractSystems are intented for the fast numerical evaluation of a fixed system. Whereas a System is intended for formulating your problem symbolically. A System can be converted to two different basic AbstractSystems, a CompiledSystem (fast, but introduce compilation overhead) and an InterpretedSystem (slower, but not compilation overhead).

HomotopyContinuation.ModelKit.CompiledSystemType
CompiledSystem <: AbstractSystem

An AbstractSystem which automatically compiles a straight line program for the fast evaluation of a system F and its Jacobian. For large systems the compilation can take some time and require a large amount of memory. If this is a problem consider InterpretedSystem.

CompiledSystem(F::System; optimizations = true)

Construct a CompiledSystem from the given System F. If optimizations = true then optimize is called on F before compiling.

source
HomotopyContinuation.ModelKit.InterpretedSystemType
InterpretedSystem <: AbstractSystem

An AbstractSystem which automatically generates a program for the fast evaluation of F and its Jacobian. The program is however, not compiled but rather interpreted. See also CompiledSystem.

InterpretedSystem(F::System; optimizations = true)

Construct an InterpretedSystem from the given System F. If optimizations = true then optimize is called on F before compiling.

source

It is also possible to set the default compile flag.

## Interface

An AbstractSystem needs to implement the following methods:

Base.size(F::AbstractSystem)
ModelKit.variables(F::AbstractSystem)::Vector{Variable}
ModelKit.parameters(F::AbstractSystem) = Variable[]
ModelKit.variable_groups(::AbstractSystem)::Union{Nothing,Vector{Vector{Variable}}} = nothing
# this has to work with x::Vector{Variable}
(F::AbstractSystem)(x, p = nothing)
# this has to work with x::Vector{ComplexF64} and x::Vector{ComplexDF64}
evaluate!(u, F::AbstractSystem, x, p = nothing)
# this has only to work with x::Vector{ComplexF64}
evaluate_and_jacobian!(u, U, F::AbstractSystem, x, p = nothing)

If the system should be used in context of a parameter homotopy it is also necessary to implement

taylor!(u, ::Val{1}, F::AbstractSystem, x, p::TaylorVector{2})

## AffineChartSystem

HomotopyContinuation.AffineChartSystemType
AffineChartSystem(F::AbstractSystem, v::PVector{T,N})

Given a system $F(x): (ℙ^{m_1} × ⋯ × ℙ^{m_N}) → ℂⁿ$ this creates a new affine system $F′$ which operates on the affine chart defined by the vector $v ∈ ℙ^{m_1} × ⋯ × ℙ^{m_N}$ and the augmented conditions $vᵀx = 1$.

source
HomotopyContinuation.on_affine_chartMethod
on_affine_chart(F::Union{System,AbstractSystem}, dimensions)

Construct an AffineChartSystem on a randomly generated chart v. Each entry is drawn idepdently from a univariate normal distribution.

source

## CompositionSystem

HomotopyContinuation.composeFunction
compose(G::Union{AbstractSystem,System}, F::Union{AbstractSystem,System})

Construct the composition $G(F(x))$. You can also use the infix operator ∘ (written by \circ).

Example

julia> @var a b c x y z

julia> g = System([a * b * c]);

julia> f = System([x+y, y + z, x + z]);

julia> compose(g, f)
Composition G ∘ F:
F:
ModelKitSystem{(0xbb16b481c0808501, 1)}:
Compiled: System of length 3
3 variables: x, y, z

x + y
y + z
x + z

G:
ModelKitSystem{(0xf0a2384a42428501, 1)}:
Compiled: System of length 1
3 variables: a, b, c

a*b*c

julia> (g ∘ f)([x,y,z])
1-element Array{Expression,1}:
(x + z)*(y + z)*(x + y)
source

## RandomizedSystem

HomotopyContinuation.RandomizedSystemType
RandomizedSystem(F::Union{System,AbstractSystem}, k::Integer;
identity_block = true,
compile = mixed)

Given a $n × N$ system Fthis constructs the system\mathfrak{R}(F; k)(x) = A⋅F(x)whereAis ak × Nmatrix. Ifidentity_block = truethen the firstkcolumns ofA form an identity matrix. The other entries are random complex numbers. See Chapter 13.5 in [SW05] for more details.

RandomizedSystem(F::Union{System,AbstractSystem}, A::Matrix{ComplexF64};
identity_block = true,
compile = mixed)

Explicitly provide the used randomization matrix. If identity = true then A has to be k × (n - k) matrix. Otherwise A has to be a k × n` matrix..

source
• SW05Sommese, A. J., & Wampler, C. W. (2005). The Numerical Solution of Systems of Polynomials Arising in Engineering and Science. World Scientific.