Reference
Polynomial
StaticPolynomials.Polynomial — Type.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.
StaticPolynomials.SExponents — Type.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.
StaticPolynomials.coefficients — Function.coefficients(f)Return the coefficients of f.
StaticPolynomials.exponents — Function.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.
StaticPolynomials.nvariables — Method.nvariables(f::Polynomial)Return the number of variables of f.
nvariables(F::AbstractSystem)The number of variables of the system F.
StaticPolynomials.nparameters — Method.nparameters(f::Polynomial)Return the number of parameters of f.
StaticPolynomials.coefficienttype — Method.coefficienttype(f::Polynomial)Return the type of the coefficients of f.
StaticPolynomials.scale_coefficients! — Method.scale_coefficients!(f, λ)Scale the coefficients of f by the factor λ.
StaticPolynomials.evaluate — Method.evaluate(f::Polynomial, x)Evaluate the polynomial f at x.
StaticPolynomials.evaluate — Method.evaluate(f::Polynomial, x, p)Evaluate f at x with parameters p.
StaticPolynomials.gradient — Function.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.
StaticPolynomials.gradient! — Function.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.
StaticPolynomials.evaluate_and_gradient — Function.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.
StaticPolynomials.evaluate_and_gradient! — Function.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).
StaticPolynomials.hessian — Method.hessian(f::Polynomial, x, [p])Compute the hessian of f at x.
StaticPolynomials.hessian! — Method.hessian!(U, f::Polynomial, x, [p])Compute the hessian of f at x and store it in U.
StaticPolynomials.gradient_and_hessian — Function. gradient_and_hessian(F::PolynomialSystem, x, [p])Compute the gradient and Hessian of f at x.
StaticPolynomials.gradient_and_hessian! — Function.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
StaticPolynomials.npolynomials — Method.npolynomials(F::AbstractSystem)The number of polynomials of the system F.
StaticPolynomials.nvariables — Method.nvariables(f::Polynomial)Return the number of variables of f.
nvariables(F::AbstractSystem)The number of variables of the system F.
StaticPolynomials.nparameters — Method.nparameters(F::AbstractSystem)The number of parameters of the system F.
Base.foreach — Method.foreach(f, F::AbstractSystem)Iterate over the polynomials of F and apply f to each polynomial.
StaticPolynomials.scale_coefficients! — Method.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.
StaticPolynomials.evaluate — Method. evaluate(F::PolynomialSystem, x)Evaluate the polynomial system F at x.
StaticPolynomials.evaluate — Method. evaluate(F::PolynomialSystem, x, p)Evaluate the polynomial system F at x with parameters p.
StaticPolynomials.evaluate! — Method. evaluate!(u, F::PolynomialSystem, x)Evaluate the polynomial system F at x and store its result in u.
StaticPolynomials.evaluate! — Method. evaluate!(u, F::PolynomialSystem, x, p)Evaluate the polynomial system F at x with parameters p and store its result in u.
StaticPolynomials.jacobian — Function. 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.
StaticPolynomials.jacobian! — Function. 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.
StaticPolynomials.evaluate_and_jacobian — Function.evaluate_and_jacobian!(F::PolynomialSystem, x, p)Evaluate the system F and its Jacobian at x with parameters p.
StaticPolynomials.evaluate_and_jacobian! — Function.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.
StaticPolynomials.hessian! — Method. 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.
StaticPolynomials.jacobian_and_hessian! — Function. 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.