-
Notifications
You must be signed in to change notification settings - Fork 3
Polynomials
A polynomial
where
we need the tuple
Note
We call this multi-index notation
CaΣoS distinguishes between indeterminate variables (symbols in a polynomial sense) and symbolic variables (variables in an optimization sense).
If for example, we want to solve the optimization problem
then
Note
Polynomials of type casos.PS can have symbolic coefficients that can be used as decision variables in polynomial optimization.
casos.Indeterminates('x',n)
casos.Indeterminates('x','y',...)
creates a tupel of n indeterminate variables; in the second case, n corresponds to the number of arguments.
Tupels of indeterminate variables can be converted into polynomials that correspond to vectors of indeterminate variables, and vice-versa.
Moreover, indeterminate variables can be used in algebraic expressions to define polynomials with constant or symbolic coefficients, e.g.,
f = [-x(2); x(1) + (x(1)^2 - 1)*x(2)]
u = K*x
if x is a tuple of indeterminate variables and K is a double, casadi.DM, or casadi.SX matrix of suitable dimensions.
The classes casos.PD and casos.PS implement polynomials of which the coefficients are constant doubles or can be symbolic expressions, respectively.
In the following we will introduce the syntax to define different polynomials.
Polynomials of degree zero correspond to constant or symbolic expressions without indeterminate variables.
They can be constant matrices where the coefficients are double such as
p1 = casos.PD([4 3; 1 0])or constant symbolic matrices such as
p2 = casos.PS.sym('a',[2,3])These expressions corresponds to the double or casadi.DMor casadi.SX matrix M.
The following syntaxes for constant matrices are also supported by casos.PS:
casos.PD(m,n)
casos.PD.zeros(m,n)
casos.PD.zeros(n)
creates a zero-degree polynomial which corresponds to a m × n matrix (resp., a column vector with length n) of zeros.
Similarly,
casos.PD.ones(m,n)
casos.PD.ones(n)creates a zero-degree polynomial which corresponds to a m × n matrix (resp., a column vector with length n) of ones.
casos.PD.eye(n)
creates a zero-degree polynomial which corresponds to the n × n identity matrix.
We define
with
A = casos.PS.sym('a', [2,2]);
x = casos.Indeterminates('x',2);
which allows us to define a new polynomial of type casos.PS using matrix multiplication
p3 = A*x;
> p3 =
>
> [(a_0)*x_1 + (a_2)*x_2]
> [(a_1)*x_1 + (a_3)*x_2]- Getting started
- Available conic solvers
- Convex and nonconvex sum-of-squares optimization
- Supported vector, matrix, and polynomial cones
- Some practical tipps for sum-of-squares
- Transitioning from other toolboxes
- Example code snippets
If you use CaΣoS, please cite us.