Reference

# Reference

## Input

We support any polynomials which follow the MultivariatePolynomials interface. By default we export the routines `@polyvar`, `PolyVar`, `differentiate` and `variables` from the DynamicPolynomials implementation. With these you can simply create variables

``````# Create variables x, y, z
@polyvar x y z
f = x^2+y^2+z^2

# You can also create an array of variables
@polyvar x[1:3] # This creates x1, x2, x3 accessed by x, x, x
f = dot(x, x) # = x^2+x^2+x^2

# Also you can create matrices of variables
# This creates x1_1, x1_2, x2_1, x2_2 accessed by
# x[1,1], x[1,2], x[2,1], x[2,2]
@polyvar x[1:2, 1:2]``````

We also provide methods construct compositions of polynomial systems:

``compose(g, f)::Composition``

Compose the polynomial systems `g` and `f`. You can also use the infix operator `∘` (written by \circ).

``````julia> @polyvar a b c x y z;
julia> g = [a * b * c];
julia> f = [x+y, y + z, x + z];
julia> expand(compose(g, f))
1-element Array{DynamicPolynomials.Polynomial{true,Int64},1}:
x²y + x²z + xy² + 2xyz + xz² + y²z + yz²``````

## Utilities

``is_homogeneous(f::MP.AbstractPolynomialLike)``

Checks whether `f` is homogeneous.

``is_homogeneous(f::MP.AbstractPolynomialLike, vars)``

Checks whether `f` is homogeneous in the variables `vars` with possible weights.

``is_homogeneous(F::Vector{MP.AbstractPolynomialLike}, variables)``

Checks whether each polynomial in `F` is homogeneous in the variables `variables`.

``````uniquevar(f::MP.AbstractPolynomialLike, tag=:x0)
uniquevar(F::MPPolys, tag=:x0)``````

Creates a unique variable.

``homogenize(f::MP.AbstractPolynomial, variable=uniquevar(f))``

Homogenize the polynomial `f` by using the given variable `variable`.

``homogenize(F::Vector{<:MP.AbstractPolynomial}, variable=uniquevar(F))``

Homogenize each polynomial in `F` by using the given variable `variable`.

``homogenize(f::MP.AbstractPolynomial, v::Vector{<:MP.AbstractVariable}, variable=uniquevar(f))``

Homogenize the variables `v` in the polynomial `f` by using the given variable `variable`.

``homogenize(F::Vector{<:MP.AbstractPolynomial}, v::Vector{<:MP.AbstractVariable}, variable=uniquevar(F))``

Homogenize the variables `v` in each polynomial in `F` by using the given variable `variable`.

``linear_system(f::Vector{<:MP.AbstractPolynomialLike})``

Given a polynomial system which represents a linear system \$Ax=b\$ return `A` and `b`. If `f` is not a linear system `nothing` is returned.

Example

``````julia> @polyvar x y z;
julia> f = [2x+3y+z+5, -1x+2y+4z-2];
julia> A, b = linear_system(f);
julia> A
2×3 Array{Int64,2}:
2  3  1
-1  2  4

julia> b
2-element Array{Int64,1}:
-5
2``````

## AffinePatches

Affine patches are there to augment projective system such that they can be considered as (locally) affine system. By default the following patches are defined

``OrthogonalPatch()``
``EmbeddingPatch()``

Holds an `PVector` onto its affine patch. With this the effect is basically the same as tracking in affine space.

``RandomPatch()``

A random patch. The vector has norm 1.

``FixedPatch()``