Reference

Reference

Polynomial

Polynomial{T, SE<:SExponents}

A Polynomial with coefficents in T in NVars variables and exponents of type SE.

Polynomial(f::MP.AbstractPolynomial, [variables])

Construct a Polynomial from f.

SExponents{N}

Store the exponents of the terms of a polynomial (the support) with N terms as an type. This results in an unique type for each possible support.

coefficients(f)

Return the coefficients of f.

exponents(::SExponents)

Converts exponents stored in a SExponents to a matrix.

exponents(f)

Return the exponents of f as an matrix where each column represents the exponents of a monomial.

nvariables(f::Polynomial)

Return the number of variables of f.

nvariables(F::AbstractSystem)

The number of variables of the system F.

nparameters(f::Polynomial)

Return the number of parameters of f.

coefficienttype(f::Polynomial)

Return the type of the coefficients of f.

scale_coefficients!(f, λ)

Scale the coefficients of f by the factor λ.

evaluate(f::Polynomial, x)

Evaluate the polynomial f at x.

evaluate(f::Polynomial, x, p)

Evaluate f at x with parameters p.

gradient(f::Polynomial, x)

Evaluate the gradient of the polynomial f at x.

gradient(f::Polynomial, x, p)

Evaluate the gradient of the polynomial f at x with parameters p.

gradient!(u, f::Polynomial, x)

Evaluate the gradient of the polynomial f at x and store the result in u.

gradient!(u, f::Polynomial, x, p)

Evaluate the gradient of the polynomial f at x with parameters p and store the result in u.

evaluate_and_gradient(f::Polynomial, x)

Evaluate the polynomial f and its gradient at x. Returns a tuple.

evaluate_and_gradient(f::Polynomial, x, p)

Evaluate the polynomial f and its gradient at x with parameters p. Returns a tuple.

evaluate_and_gradient!(u, f::Polynomial, x)

Evaluate the polynomial f and its gradient at x. Stores the gradient in u and returns the f(x).

evaluate_and_gradient!(u, f::Polynomial, x, p)

Evaluate the polynomial f and its gradient at x with parameters p. Stores the gradient in u and returns the f(x).

hessian(f::Polynomial, x, [p])

Compute the hessian of f at x.

hessian!(U, f::Polynomial, x, [p])

Compute the hessian of f at x and store it in U.

 gradient_and_hessian(F::PolynomialSystem, x, [p])

Compute the gradient and Hessian of f at x.

gradient_and_hessian!(u, U, f::Polynomial, x, [p])

Compute the gradient and Hessian of f at x and store them in u and U.

differentiate_parameters(f::Polynomial, x, p)

Evaluate the gradient of the polynomial f w.r.t. the parameters at x with parameters p.

differentiate_parameters!(u, f::Polynomial, x, p)

Evaluate the gradient of the polynomial f w.r.t. the parameters at x with parameters p and store the result in u.

Systems of Polynomials

PolynomialSystem{N, NVars, NParams, <:Tuple}

A polynomial system of N polynomials in NVars variables with NParams variables.

Constructors:

PolynomialSystem(polys::AbstractVector{<:MP.AbstractPolynomial}; variables=MP.variables(polys), parameters=nothing)
PolynomialSystem(polys::MP.AbstractPolynomial...; kwargs...)

Create a system of polynomials from the given polynomials polys. This function is by design not typestable.

Example

julia> import DynamicPolynomials: @polyvar
julia> @polyvar x y a
julia> PolynomialSystem(x^2+y^2+3, x-y+2, x^2+2y+a; parameters=[a])
PolynomialSystem{3, 2}:
 3 + x² + y²

 2 + x - y

 x² + 2y
npolynomials(F::AbstractSystem)

The number of polynomials of the system F.

nvariables(f::Polynomial)

Return the number of variables of f.

nvariables(F::AbstractSystem)

The number of variables of the system F.

nparameters(F::AbstractSystem)

The number of parameters of the system F.

Base.foreachMethod.
foreach(f, F::AbstractSystem)

Iterate over the polynomials of F and apply f to each polynomial.

scale_coefficients!(F::AbstractSystem{T, M}, λ::AbstractVector)

Scale the coefficients of the polynomials fᵢ of F by the factor λᵢ. λ needs to have have length M.

 evaluate(F::PolynomialSystem, x)

Evaluate the polynomial system F at x.

 evaluate(F::PolynomialSystem, x, p)

Evaluate the polynomial system F at x with parameters p.

 evaluate!(u, F::PolynomialSystem, x)

Evaluate the polynomial system F at x and store its result in u.

 evaluate!(u, F::PolynomialSystem, x, p)

Evaluate the polynomial system F at x with parameters p and store its result in u.

 jacobian(F::PolynomialSystem, x)

Evaluate the Jacobian of the polynomial system F at x.

 jacobian(F::PolynomialSystem, x, p)

Evaluate the Jacobian of the polynomial system F at x with parameters p.

 jacobian!(U, F::PolynomialSystem, x)

Evaluate the Jacobian of the polynomial system F at x and store its result in U.

 jacobian(U, F::PolynomialSystem, x, p)

Evaluate the Jacobian of the polynomial system F at x with parameters p and store its result in U.

evaluate_and_jacobian!(F::PolynomialSystem, x, p)

Evaluate the system F and its Jacobian at x with parameters p.

evaluate_and_jacobian!(u, U, F::PolynomialSystem, x)

Evaluate the system F and its Jacobian at x and store the results in u (evalution) and U (Jacobian).

evaluate_and_jacobian!(u, U, F::PolynomialSystem, x, p)

Evaluate the system F and its Jacobian at x with parameters p and store the results in u (evalution) and U (Jacobian).

evaluate_and_jacobian(F::PolynomialSystem, x)

Evaluate the system F and its Jacobian at x.

 hessian!(U::AbstractArray{T,3}, F::PolynomialSystem, x, [p])

Evaluate the Hessian of the polynomial system F at x and store its result in U.

 jacobian_and_hessian!(u, U::AbstractArray{T,3}, F::PolynomialSystem, x)

Evaluate the Jacobian and Hessian of the polynomial system F at x and store its result in u and U.

 differentiate_parameters(F::PolynomialSystem, x, p)

Evaluate the derivative of the polynomial system F at x with parameters p with respect to the parameters and store the result in U.

 differentiate_parameters!(U, F::PolynomialSystem, x, p)

Evaluate the derivative of the polynomial system F at x with parameters p with respect to the parameters and store the result in U.