Drake
Drake C++ Documentation
drake::symbolic Namespace Reference

Namespaces

 test
 

Classes

struct  BasisElementGradedReverseLexOrder
 Implements Graded reverse lexicographic order. More...
 
class  BinaryExpressionCell
 Represents the base class for binary expressions. More...
 
class  ChebyshevBasisElement
 ChebyshevBasisElement represents an element of Chebyshev polynomial basis, written as the product of Chebyshev polynomials, in the form Tₚ₀(x₀)Tₚ₁(x₁)...Tₚₙ(xₙ), where each Tₚᵢ(xᵢ) is a (univariate) Chebyshev polynomial of degree pᵢ. More...
 
class  ChebyshevPolynomial
 Represents the Chebyshev polynomial of the first kind Tₙ(x). More...
 
class  CodeGenVisitor
 Visitor class for code generation. More...
 
class  Environment
 Represents a symbolic environment (mapping from a variable to a value). More...
 
class  Expression
 Represents a symbolic form of an expression. More...
 
class  ExpressionAbs
 Symbolic expression representing absolute value function. More...
 
class  ExpressionAcos
 Symbolic expression representing arccosine function. More...
 
class  ExpressionAdd
 Symbolic expression representing an addition which is a sum of products. More...
 
class  ExpressionAddFactory
 Factory class to help build ExpressionAdd expressions. More...
 
class  ExpressionAsin
 Symbolic expression representing arcsine function. More...
 
class  ExpressionAtan
 Symbolic expression representing arctangent function. More...
 
class  ExpressionAtan2
 Symbolic expression representing atan2 function (arctangent function with two arguments). More...
 
class  ExpressionCeiling
 Symbolic expression representing ceil function. More...
 
class  ExpressionCell
 Represents an abstract class which is the base of concrete symbolic-expression classes. More...
 
class  ExpressionCos
 Symbolic expression representing cosine function. More...
 
class  ExpressionCosh
 Symbolic expression representing hyperbolic cosine function. More...
 
class  ExpressionDiv
 Symbolic expression representing division. More...
 
class  ExpressionExp
 Symbolic expression representing exponentiation using the base of natural logarithms. More...
 
class  ExpressionFloor
 Symbolic expression representing floor function. More...
 
class  ExpressionIfThenElse
 Symbolic expression representing if-then-else expression. More...
 
class  ExpressionLog
 Symbolic expression representing logarithms. More...
 
class  ExpressionMax
 Symbolic expression representing max function. More...
 
class  ExpressionMin
 Symbolic expression representing min function. More...
 
class  ExpressionMul
 Symbolic expression representing a multiplication of powers. More...
 
class  ExpressionMulFactory
 Factory class to help build ExpressionMul expressions. More...
 
class  ExpressionNaN
 Symbolic expression representing NaN (not-a-number). More...
 
class  ExpressionPow
 Symbolic expression representing power function. More...
 
class  ExpressionSin
 Symbolic expression representing sine function. More...
 
class  ExpressionSinh
 Symbolic expression representing hyperbolic sine function. More...
 
class  ExpressionSqrt
 Symbolic expression representing square-root. More...
 
class  ExpressionTan
 Symbolic expression representing tangent function. More...
 
class  ExpressionTanh
 Symbolic expression representing hyperbolic tangent function. More...
 
class  ExpressionUninterpretedFunction
 Symbolic expression representing an uninterpreted function. More...
 
class  ExpressionVar
 Symbolic expression representing a variable. More...
 
class  Formula
 Represents a symbolic form of a first-order logic formula. More...
 
class  FormulaAnd
 Symbolic formula representing conjunctions (f1 ∧ ... More...
 
class  FormulaCell
 Represents an abstract class which is the base of concrete symbolic-formula classes (i.e. More...
 
class  FormulaEq
 Symbolic formula representing equality (e1 = e2). More...
 
class  FormulaFalse
 Symbolic formula representing false. More...
 
class  FormulaForall
 Symbolic formula representing universal quantifications (∀ x₁, ..., * xn. More...
 
class  FormulaGeq
 Symbolic formula representing 'greater-than-or-equal-to' (e1 ≥ e2). More...
 
class  FormulaGt
 Symbolic formula representing 'greater-than' (e1 > e2). More...
 
class  FormulaIsnan
 Symbolic formula representing isnan predicate. More...
 
class  FormulaLeq
 Symbolic formula representing 'less-than-or-equal-to' (e1 ≤ e2). More...
 
class  FormulaLt
 Symbolic formula representing 'less-than' (e1 < e2). More...
 
class  FormulaNeq
 Symbolic formula representing disequality (e1 ≠ e2). More...
 
class  FormulaNot
 Symbolic formula representing negations (¬f). More...
 
class  FormulaOr
 Symbolic formula representing disjunctions (f1 ∨ ... More...
 
class  FormulaPositiveSemidefinite
 Symbolic formula representing positive-semidefinite (PSD) constraint. More...
 
class  FormulaTrue
 Symbolic formula representing true. More...
 
class  FormulaVar
 Symbolic formula representing a Boolean variable. More...
 
class  GenericPolynomial
 Represents symbolic generic polynomials using a given basis (for example, monomial basis, Chebyshev basis, etc). More...
 
struct  GradedReverseLexOrder
 Implements Graded reverse lexicographic order. More...
 
class  Monomial
 Represents a monomial, a product of powers of variables with non-negative integer exponents. More...
 
class  MonomialBasisElement
 MonomialBasisElement represents a monomial, a product of powers of variables with non-negative integer exponents. More...
 
class  NaryFormulaCell
 Represents the base class for N-ary logic operators (∧ and ∨). More...
 
class  Polynomial
 Represents symbolic polynomials. More...
 
class  PolynomialBasisElement
 Each polynomial p(x) can be written as a linear combination of its basis elements p(x) = ∑ᵢ cᵢ * ϕᵢ(x), where ϕᵢ(x) is the i'th element in the basis, cᵢ is the coefficient of that element. More...
 
class  RationalFunction
 Represents symbolic rational function. More...
 
class  RelationalFormulaCell
 Represents the base class for relational operators (==, !=, <, <=, >, >=). More...
 
class  RewritingRule
 A RewritingRule, lhs => rhs, consists of two Patterns lhs and rhs. More...
 
struct  SinCos
 Represents a pair of Variables corresponding to sin(q) and cos(q). More...
 
class  UnaryExpressionCell
 Represents the base class for unary expressions. More...
 
class  Variable
 Represents a symbolic variable. More...
 
class  Variables
 Represents a set of variables. More...
 

Typedefs

using Substitution = std::unordered_map< Variable, Expression >
 
template<typename BasisElement >
using GenericPolynomialEnable = std::enable_if_t< std::is_base_of_v< PolynomialBasisElement, BasisElement >, GenericPolynomial< BasisElement > >
 Defines an explicit SFINAE alias for use with return types to dissuade CTAD from trying to instantiate an invalid GenericElement<> for operator overloads, (if that's actually the case). More...
 
using Pattern = Expression
 A pattern is an expression which possibly includes variables which represent placeholders. More...
 
using Rewriter = std::function< Expression(const Expression &)>
 A Rewriter is a function from an Expression to an Expression. More...
 
using SinCosSubstitution = std::unordered_map< Variable, SinCos >
 

Enumerations

enum  ExpressionKind : std::uint16_t {
  Constant = 0, Var = 0x7FF1u, Add, Mul,
  Div, Log, Abs, Exp,
  Sqrt, Pow, Sin, Cos,
  Tan, Asin, Acos, Atan,
  Atan2 = 0xFFF1u, Sinh, Cosh, Tanh,
  Min, Max, Ceil, Floor,
  IfThenElse, NaN, UninterpretedFunction
}
 Kinds of symbolic expressions. More...
 
enum  FormulaKind {
  False, True, Var, Eq,
  Neq, Gt, Geq, Lt,
  Leq, And, Or, Not,
  Forall, Isnan, PositiveSemidefinite
}
 Kinds of symbolic formulas. More...
 
enum  SinCosSubstitutionType { kAngle, kHalfAnglePreferSin, kHalfAnglePreferCos }
 

Functions

std::map< ChebyshevBasisElement, doubleoperator * (const ChebyshevBasisElement &a, const ChebyshevBasisElement &b)
 Returns the product of two Chebyshev basis elements. More...
 
std::ostream & operator<< (std::ostream &out, const ChebyshevBasisElement &m)
 
std::ostream & operator<< (std::ostream &out, const ChebyshevPolynomial &p)
 
double EvaluateChebyshevPolynomial (double var_val, int degree)
 Evaluates a Chebyshev polynomial at a given value. More...
 
std::string CodeGen (const std::string &function_name, const std::vector< Variable > &parameters, const Expression &e)
 For a given symbolic expression e, generates two C functions, <function_name> and <function_name>_meta. More...
 
template<typename Derived >
std::string CodeGen (const std::string &function_name, const std::vector< Variable > &parameters, const Eigen::PlainObjectBase< Derived > &M)
 For a given symbolic dense matrix M, generates two C functions, <function_name> and <function_name>_meta. More...
 
std::string CodeGen (const std::string &function_name, const std::vector< Variable > &parameters, const Eigen::Ref< const Eigen::SparseMatrix< Expression, Eigen::ColMajor >> &M)
 For a given symbolic column-major sparse matrix M, generates two C functions, <function_name> and <function_name>_meta. More...
 
bool IsAffine (const Eigen::Ref< const MatrixX< Expression >> &m, const Variables &vars)
 Checks if every element in m is affine in vars. More...
 
bool IsAffine (const Eigen::Ref< const MatrixX< Expression >> &m)
 Checks if every element in m is affine. More...
 
void DecomposeLinearExpressions (const Eigen::Ref< const VectorX< Expression >> &expressions, const Eigen::Ref< const VectorX< Variable >> &vars, EigenPtr< Eigen::MatrixXd > M)
 Decomposes expressions into M * vars. More...
 
void DecomposeAffineExpressions (const Eigen::Ref< const VectorX< Expression >> &expressions, const Eigen::Ref< const VectorX< Variable >> &vars, EigenPtr< Eigen::MatrixXd > M, EigenPtr< Eigen::VectorXd > v)
 Decomposes expressions into M * vars + v. More...
 
void ExtractAndAppendVariablesFromExpression (const symbolic::Expression &e, VectorX< Variable > *vars, std::unordered_map< symbolic::Variable::Id, int > *map_var_to_index)
 Given an expression e, extract all variables inside e, append these variables to vars if they are not included in vars yet. More...
 
std::pair< VectorX< Variable >, std::unordered_map< symbolic::Variable::Id, int > > ExtractVariablesFromExpression (const symbolic::Expression &e)
 Given an expression e, extracts all variables inside e. More...
 
std::pair< VectorX< Variable >, std::unordered_map< Variable::Id, int > > ExtractVariablesFromExpression (const Eigen::Ref< const VectorX< Expression >> &expressions)
 Overloads ExtractVariablesFromExpression but with a vector of expressions. More...
 
void DecomposeQuadraticPolynomial (const symbolic::Polynomial &poly, const std::unordered_map< symbolic::Variable::Id, int > &map_var_to_index, Eigen::MatrixXd *Q, Eigen::VectorXd *b, double *c)
 Given a quadratic polynomial poly, decomposes it into the form 0.5 * x' Q * x + b' * x + c. More...
 
void DecomposeAffineExpressions (const Eigen::Ref< const VectorX< symbolic::Expression >> &v, Eigen::MatrixXd *A, Eigen::VectorXd *b, VectorX< Variable > *vars)
 Given a vector of affine expressions v, decompose it to \( v = A vars + b \). More...
 
int DecomposeAffineExpression (const symbolic::Expression &e, const std::unordered_map< symbolic::Variable::Id, int > &map_var_to_index, EigenPtr< Eigen::RowVectorXd > coeffs, double *constant_term)
 Decomposes an affine combination e = c0 + c1 * v1 + ... More...
 
std::tuple< MatrixX< Expression >, VectorX< Expression >, VectorX< Expression > > DecomposeLumpedParameters (const Eigen::Ref< const VectorX< Expression >> &f, const Eigen::Ref< const VectorX< Variable >> &parameters)
 Given a vector of Expressions f and a list of parameters we define all additional variables in f to be a vector of "non-parameter variables", n. More...
 
Environment PopulateRandomVariables (Environment env, const Variables &variables, RandomGenerator *random_generator)
 Populates the environment env by sampling values for the unassigned random variables in variables using random_generator. More...
 
Expression operator+ (Expression lhs, const Expression &rhs)
 
Expressionoperator+= (Expression &lhs, const Expression &rhs)
 
Expression operator+ (const Expression &e)
 
Expression operator- (Expression lhs, const Expression &rhs)
 
Expressionoperator-= (Expression &lhs, const Expression &rhs)
 
Expression operator- (const Expression &e)
 
Expression operator * (Expression lhs, const Expression &rhs)
 
Expressionoperator *= (Expression &lhs, const Expression &rhs)
 
Expression operator/ (Expression lhs, const Expression &rhs)
 
Expressionoperator/= (Expression &lhs, const Expression &rhs)
 
Expression log (const Expression &e)
 
Expression abs (const Expression &e)
 
Expression exp (const Expression &e)
 
Expression sqrt (const Expression &e)
 
Expression pow (const Expression &e1, const Expression &e2)
 
Expression sin (const Expression &e)
 
Expression cos (const Expression &e)
 
Expression tan (const Expression &e)
 
Expression asin (const Expression &e)
 
Expression acos (const Expression &e)
 
Expression atan (const Expression &e)
 
Expression atan2 (const Expression &e1, const Expression &e2)
 
Expression sinh (const Expression &e)
 
Expression cosh (const Expression &e)
 
Expression tanh (const Expression &e)
 
Expression min (const Expression &e1, const Expression &e2)
 
Expression max (const Expression &e1, const Expression &e2)
 
Expression clamp (const Expression &v, const Expression &lo, const Expression &hi)
 
Expression ceil (const Expression &e)
 
Expression floor (const Expression &e)
 
Expression if_then_else (const Formula &f_cond, const Expression &e_then, const Expression &e_else)
 
Expression uninterpreted_function (std::string name, std::vector< Expression > arguments)
 Constructs an uninterpreted-function expression with name and arguments. More...
 
void swap (Expression &a, Expression &b)
 
std::ostream & operator<< (std::ostream &os, const Expression &e)
 
bool is_constant (const Expression &e)
 Checks if e is a constant expression. More...
 
bool is_constant (const Expression &e, double v)
 Checks if e is a constant expression representing v. More...
 
bool is_zero (const Expression &e)
 Checks if e is 0.0. More...
 
bool is_one (const Expression &e)
 Checks if e is 1.0. More...
 
bool is_neg_one (const Expression &e)
 Checks if e is -1.0. More...
 
bool is_two (const Expression &e)
 Checks if e is 2.0. More...
 
bool is_nan (const Expression &e)
 Checks if e is NaN. More...
 
bool is_variable (const Expression &e)
 Checks if e is a variable expression. More...
 
bool is_addition (const Expression &e)
 Checks if e is an addition expression. More...
 
bool is_multiplication (const Expression &e)
 Checks if e is a multiplication expression. More...
 
bool is_division (const Expression &e)
 Checks if e is a division expression. More...
 
bool is_log (const Expression &e)
 Checks if e is a log expression. More...
 
bool is_abs (const Expression &e)
 Checks if e is an abs expression. More...
 
bool is_exp (const Expression &e)
 Checks if e is an exp expression. More...
 
bool is_sqrt (const Expression &e)
 Checks if e is a square-root expression. More...
 
bool is_pow (const Expression &e)
 Checks if e is a power-function expression. More...
 
bool is_sin (const Expression &e)
 Checks if e is a sine expression. More...
 
bool is_cos (const Expression &e)
 Checks if e is a cosine expression. More...
 
bool is_tan (const Expression &e)
 Checks if e is a tangent expression. More...
 
bool is_asin (const Expression &e)
 Checks if e is an arcsine expression. More...
 
bool is_acos (const Expression &e)
 Checks if e is an arccosine expression. More...
 
bool is_atan (const Expression &e)
 Checks if e is an arctangent expression. More...
 
bool is_atan2 (const Expression &e)
 Checks if e is an arctangent2 expression. More...
 
bool is_sinh (const Expression &e)
 Checks if e is a hyperbolic-sine expression. More...
 
bool is_cosh (const Expression &e)
 Checks if e is a hyperbolic-cosine expression. More...
 
bool is_tanh (const Expression &e)
 Checks if e is a hyperbolic-tangent expression. More...
 
bool is_min (const Expression &e)
 Checks if e is a min expression. More...
 
bool is_max (const Expression &e)
 Checks if e is a max expression. More...
 
bool is_ceil (const Expression &e)
 Checks if e is a ceil expression. More...
 
bool is_floor (const Expression &e)
 Checks if e is a floor expression. More...
 
bool is_if_then_else (const Expression &e)
 Checks if e is an if-then-else expression. More...
 
bool is_uninterpreted_function (const Expression &e)
 Checks if e is an uninterpreted-function expression. More...
 
double get_constant_value (const Expression &e)
 Returns the constant value of the constant expression e. More...
 
const Variableget_variable (const Expression &e)
 Returns the embedded variable in the variable expression e. More...
 
const Expressionget_argument (const Expression &e)
 Returns the argument in the unary expression e. More...
 
const Expressionget_first_argument (const Expression &e)
 Returns the first argument of the binary expression e. More...
 
const Expressionget_second_argument (const Expression &e)
 Returns the second argument of the binary expression e. More...
 
double get_constant_in_addition (const Expression &e)
 Returns the constant part of the addition expression e. More...
 
const std::map< Expression, double > & get_expr_to_coeff_map_in_addition (const Expression &e)
 Returns the map from an expression to its coefficient in the addition expression e. More...
 
double get_constant_in_multiplication (const Expression &e)
 Returns the constant part of the multiplication expression e. More...
 
const std::map< Expression, Expression > & get_base_to_exponent_map_in_multiplication (const Expression &e)
 Returns the map from a base expression to its exponent expression in the multiplication expression e. More...
 
const std::string & get_uninterpreted_function_name (const Expression &e)
 Returns the name of an uninterpreted-function expression e. More...
 
const std::vector< Expression > & get_uninterpreted_function_arguments (const Expression &e)
 Returns the arguments of an uninterpreted-function expression e. More...
 
const Formulaget_conditional_formula (const Expression &e)
 Returns the conditional formula in the if-then-else expression e. More...
 
const Expressionget_then_expression (const Expression &e)
 Returns the 'then' expression in the if-then-else expression e. More...
 
const Expressionget_else_expression (const Expression &e)
 Returns the 'else' expression in the if-then-else expression e. More...
 
Expression operator+ (const Variable &var)
 
Expression operator- (const Variable &var)
 
Expression TaylorExpand (const Expression &f, const Environment &a, int order)
 Returns the Taylor series expansion of f around a of order order. More...
 
template<typename MatrixL , typename MatrixR >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< MatrixL >, MatrixL > &&std::is_base_of_v< Eigen::MatrixBase< MatrixR >, MatrixR > &&std::is_same_v< typename MatrixL::Scalar, Expression > &&std::is_same_v< typename MatrixR::Scalar, double >, internal::ExpressionMatMulResult< MatrixL, MatrixR > > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<typename MatrixL , typename MatrixR >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< MatrixL >, MatrixL > &&std::is_base_of_v< Eigen::MatrixBase< MatrixR >, MatrixR > &&std::is_same_v< typename MatrixL::Scalar, double > &&std::is_same_v< typename MatrixR::Scalar, Expression >, internal::ExpressionMatMulResult< MatrixL, MatrixR > > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<typename MatrixL , typename MatrixR >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< MatrixL >, MatrixL > &&std::is_base_of_v< Eigen::MatrixBase< MatrixR >, MatrixR > &&std::is_same_v< typename MatrixL::Scalar, Expression > &&std::is_same_v< typename MatrixR::Scalar, Variable >, internal::ExpressionMatMulResult< MatrixL, MatrixR > > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<typename MatrixL , typename MatrixR >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< MatrixL >, MatrixL > &&std::is_base_of_v< Eigen::MatrixBase< MatrixR >, MatrixR > &&std::is_same_v< typename MatrixL::Scalar, Variable > &&std::is_same_v< typename MatrixR::Scalar, Expression >, internal::ExpressionMatMulResult< MatrixL, MatrixR > > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<typename MatrixL , typename MatrixR >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< MatrixL >, MatrixL > &&std::is_base_of_v< Eigen::MatrixBase< MatrixR >, MatrixR > &&std::is_same_v< typename MatrixL::Scalar, Variable > &&std::is_same_v< typename MatrixR::Scalar, double >, internal::ExpressionMatMulResult< MatrixL, MatrixR > > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<typename MatrixL , typename MatrixR >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< MatrixL >, MatrixL > &&std::is_base_of_v< Eigen::MatrixBase< MatrixR >, MatrixR > &&std::is_same_v< typename MatrixL::Scalar, double > &&std::is_same_v< typename MatrixR::Scalar, Variable >, internal::ExpressionMatMulResult< MatrixL, MatrixR > > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<typename MatrixL , typename MatrixR >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< MatrixL >, MatrixL > &&std::is_base_of_v< Eigen::MatrixBase< MatrixR >, MatrixR > &&std::is_same_v< typename MatrixL::Scalar, Variable > &&std::is_same_v< typename MatrixR::Scalar, Variable >, internal::ExpressionMatMulResult< MatrixL, MatrixR > > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<typename MatrixL , typename MatrixR >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< MatrixL >, MatrixL > &&std::is_base_of_v< Eigen::MatrixBase< MatrixR >, MatrixR > &&std::is_same_v< typename MatrixL::Scalar, Expression > &&std::is_same_v< typename MatrixR::Scalar, Expression >, internal::ExpressionMatMulResult< MatrixL, MatrixR > > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<int Dim, int LhsMode, int RhsMode, int LhsOptions, int RhsOptions>
auto operator * (const Eigen::Transform< Expression, Dim, LhsMode, LhsOptions > &t1, const Eigen::Transform< double, Dim, RhsMode, RhsOptions > &t2)
 Transform<double> * Transform<Expression> => Transform<Expression> More...
 
template<int Dim, int LhsMode, int RhsMode, int LhsOptions, int RhsOptions>
auto operator * (const Eigen::Transform< double, Dim, LhsMode, LhsOptions > &t1, const Eigen::Transform< Expression, Dim, RhsMode, RhsOptions > &t2)
 Transform<Expression> * Transform<double> => Transform<Expression> More...
 
template<typename Derived >
std::enable_if_t< std::is_same_v< typename Derived::Scalar, Expression >, MatrixLikewise< double, Derived > > Evaluate (const Eigen::MatrixBase< Derived > &m, const Environment &env=Environment{}, RandomGenerator *random_generator=nullptr)
 Evaluates a symbolic matrix m using env and random_generator. More...
 
Eigen::SparseMatrix< doubleEvaluate (const Eigen::Ref< const Eigen::SparseMatrix< Expression >> &m, const Environment &env=Environment{})
 Evaluates m using a given environment (by default, an empty environment). More...
 
template<typename Derived >
MatrixLikewise< Expression, Derived > Substitute (const Eigen::MatrixBase< Derived > &m, const Substitution &subst)
 Substitutes a symbolic matrix m using a given substitution subst. More...
 
template<typename Derived >
MatrixLikewise< Expression, Derived > Substitute (const Eigen::MatrixBase< Derived > &m, const Variable &var, const Expression &e)
 Substitutes var with e in a symbolic matrix m. More...
 
VectorX< VariableGetVariableVector (const Eigen::Ref< const VectorX< Expression >> &expressions)
 Constructs a vector of variables from the vector of variable expressions. More...
 
MatrixX< ExpressionJacobian (const Eigen::Ref< const VectorX< Expression >> &f, const std::vector< Variable > &vars)
 Computes the Jacobian matrix J of the vector function f with respect to vars. More...
 
MatrixX< ExpressionJacobian (const Eigen::Ref< const VectorX< Expression >> &f, const Eigen::Ref< const VectorX< Variable >> &vars)
 Computes the Jacobian matrix J of the vector function f with respect to vars. More...
 
Variables GetDistinctVariables (const Eigen::Ref< const MatrixX< Expression >> &v)
 Returns the distinct variables in the matrix of expressions. More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_base_of_v< Eigen::MatrixBase< DerivedA >, DerivedA > &&std::is_base_of_v< Eigen::MatrixBase< DerivedB >, DerivedB > &&std::is_same_v< typename DerivedA::Scalar, Expression > &&std::is_same_v< typename DerivedB::Scalar, Expression >, bool > CheckStructuralEquality (const DerivedA &m1, const DerivedB &m2)
 Checks if two Eigen::Matrix<Expression> m1 and m2 are structurally equal. More...
 
bool is_integer (double v)
 
bool is_positive_integer (double v)
 
bool is_non_negative_integer (double v)
 
bool is_variable (const ExpressionCell &c)
 Checks if c is a variable expression. More...
 
bool is_unary (const ExpressionCell &c)
 Checks if c is a unary expression. More...
 
bool is_binary (const ExpressionCell &c)
 Checks if c is a binary expression. More...
 
bool is_addition (const ExpressionCell &c)
 Checks if c is an addition expression. More...
 
bool is_multiplication (const ExpressionCell &c)
 Checks if c is an multiplication expression. More...
 
bool is_division (const ExpressionCell &c)
 Checks if c is a division expression. More...
 
bool is_log (const ExpressionCell &c)
 Checks if c is a log expression. More...
 
bool is_abs (const ExpressionCell &c)
 Checks if c is an absolute-value-function expression. More...
 
bool is_exp (const ExpressionCell &c)
 Checks if c is an exp expression. More...
 
bool is_sqrt (const ExpressionCell &c)
 Checks if c is a square-root expression. More...
 
bool is_pow (const ExpressionCell &c)
 Checks if c is a power-function expression. More...
 
bool is_sin (const ExpressionCell &c)
 Checks if c is a sine expression. More...
 
bool is_cos (const ExpressionCell &c)
 Checks if c is a cosine expression. More...
 
bool is_tan (const ExpressionCell &c)
 Checks if c is a tangent expression. More...
 
bool is_asin (const ExpressionCell &c)
 Checks if c is an arcsine expression. More...
 
bool is_acos (const ExpressionCell &c)
 Checks if c is an arccosine expression. More...
 
bool is_atan (const ExpressionCell &c)
 Checks if c is an arctangent expression. More...
 
bool is_atan2 (const ExpressionCell &c)
 Checks if c is a arctangent2 expression. More...
 
bool is_sinh (const ExpressionCell &c)
 Checks if c is a hyperbolic-sine expression. More...
 
bool is_cosh (const ExpressionCell &c)
 Checks if c is a hyperbolic-cosine expression. More...
 
bool is_tanh (const ExpressionCell &c)
 Checks if c is a hyperbolic-tangent expression. More...
 
bool is_min (const ExpressionCell &c)
 Checks if c is a min expression. More...
 
bool is_max (const ExpressionCell &c)
 Checks if c is a max expression. More...
 
bool is_ceil (const ExpressionCell &c)
 Checks if c is a ceil expression. More...
 
bool is_floor (const ExpressionCell &c)
 Checks if c is a floor expression. More...
 
bool is_if_then_else (const ExpressionCell &c)
 Checks if c is an if-then-else expression. More...
 
bool is_uninterpreted_function (const ExpressionCell &c)
 Checks if c is an uninterpreted-function expression. More...
 
bool operator< (ExpressionKind k1, ExpressionKind k2)
 Total ordering between ExpressionKinds. More...
 
template<typename Result , typename Visitor , typename... Args>
Result VisitPolynomial (Visitor *v, const Expression &e, Args &&... args)
 Calls visitor object v with a polynomial symbolic-expression e, and arguments args. More...
 
template<typename Result , typename Visitor , typename... Args>
Result VisitExpression (Visitor *v, const Expression &e, Args &&... args)
 Calls visitor object v with a symbolic-expression e, and arguments args. More...
 
bool operator< (FormulaKind k1, FormulaKind k2)
 
Formula forall (const Variables &vars, const Formula &f)
 Returns a formula f, universally quantified by variables vars. More...
 
Formula make_conjunction (const std::set< Formula > &formulas)
 Returns a conjunction of formulas. More...
 
Formula operator && (const Formula &f1, const Formula &f2)
 
Formula operator && (const Variable &v, const Formula &f)
 
Formula operator && (const Formula &f, const Variable &v)
 
Formula operator && (const Variable &v1, const Variable &v2)
 
Formula make_disjunction (const std::set< Formula > &formulas)
 Returns a disjunction of formulas. More...
 
Formula operator|| (const Formula &f1, const Formula &f2)
 
Formula operator|| (const Variable &v, const Formula &f)
 
Formula operator|| (const Formula &f, const Variable &v)
 
Formula operator|| (const Variable &v1, const Variable &v2)
 
Formula operator! (const Formula &f)
 
Formula operator! (const Variable &v)
 
Formula operator== (const Expression &e1, const Expression &e2)
 
Formula operator!= (const Expression &e1, const Expression &e2)
 
Formula operator< (const Expression &e1, const Expression &e2)
 
Formula operator<= (const Expression &e1, const Expression &e2)
 
Formula operator> (const Expression &e1, const Expression &e2)
 
Formula operator>= (const Expression &e1, const Expression &e2)
 
Formula isnan (const Expression &e)
 Returns a Formula for the predicate isnan(e) to the given expression. More...
 
Formula isinf (const Expression &e)
 Returns a Formula determining if the given expression e is a positive or negative infinity. More...
 
Formula isfinite (const Expression &e)
 Returns a Formula determining if the given expression e has a finite value. More...
 
Formula positive_semidefinite (const Eigen::Ref< const MatrixX< Expression >> &m)
 Returns a symbolic formula constraining m to be a positive-semidefinite matrix. More...
 
Formula positive_semidefinite (const MatrixX< Expression > &m, Eigen::UpLoType mode)
 Constructs and returns a symbolic positive-semidefinite formula from m. More...
 
template<typename Derived >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< typename Derived::Scalar, Expression >, Formulapositive_semidefinite (const Eigen::TriangularView< Derived, Eigen::Lower > &l)
 Constructs and returns a symbolic positive-semidefinite formula from a lower triangular-view l. More...
 
template<typename Derived >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< typename Derived::Scalar, Expression >, Formulapositive_semidefinite (const Eigen::TriangularView< Derived, Eigen::Upper > &u)
 Constructs and returns a symbolic positive-semidefinite formula from an upper triangular-view u. More...
 
std::ostream & operator<< (std::ostream &os, const Formula &f)
 
bool is_false (const Formula &f)
 Checks if f is structurally equal to False formula. More...
 
bool is_true (const Formula &f)
 Checks if f is structurally equal to True formula. More...
 
bool is_variable (const Formula &f)
 Checks if f is a variable formula. More...
 
bool is_equal_to (const Formula &f)
 Checks if f is a formula representing equality (==). More...
 
bool is_not_equal_to (const Formula &f)
 Checks if f is a formula representing disequality (!=). More...
 
bool is_greater_than (const Formula &f)
 Checks if f is a formula representing greater-than (>). More...
 
bool is_greater_than_or_equal_to (const Formula &f)
 Checks if f is a formula representing greater-than-or-equal-to (>=). More...
 
bool is_less_than (const Formula &f)
 Checks if f is a formula representing less-than (<). More...
 
bool is_less_than_or_equal_to (const Formula &f)
 Checks if f is a formula representing less-than-or-equal-to (<=). More...
 
bool is_relational (const Formula &f)
 Checks if f is a relational formula ({==, !=, >, >=, <, <=}). More...
 
bool is_conjunction (const Formula &f)
 Checks if f is a conjunction (∧). More...
 
bool is_disjunction (const Formula &f)
 Checks if f is a disjunction (∨). More...
 
bool is_nary (const Formula &f)
 Checks if f is a n-ary formula ({∧, ∨}). More...
 
bool is_negation (const Formula &f)
 Checks if f is a negation (¬). More...
 
bool is_forall (const Formula &f)
 Checks if f is a Forall formula (∀). More...
 
bool is_isnan (const Formula &f)
 Checks if f is an isnan formula. More...
 
bool is_positive_semidefinite (const Formula &f)
 Checks if f is a positive-semidefinite formula. More...
 
const Variableget_variable (const Formula &f)
 Returns the embedded variable in the variable formula f. More...
 
const Expressionget_lhs_expression (const Formula &f)
 Returns the lhs-argument of a relational formula f. More...
 
const Expressionget_rhs_expression (const Formula &f)
 Returns the rhs-argument of a relational formula f. More...
 
const Expressionget_unary_expression (const Formula &f)
 Returns the expression in a unary expression formula f. More...
 
const std::set< Formula > & get_operands (const Formula &f)
 Returns the set of formulas in a n-ary formula f. More...
 
const Formulaget_operand (const Formula &f)
 Returns the formula in a negation formula f. More...
 
const Variablesget_quantified_variables (const Formula &f)
 Returns the quantified variables in a forall formula f. More...
 
const Formulaget_quantified_formula (const Formula &f)
 Returns the quantified formula in a forall formula f. More...
 
const MatrixX< Expression > & get_matrix_in_positive_semidefinite (const Formula &f)
 Returns the matrix in a positive-semidefinite formula f. More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar()==typename DerivedB::Scalar()), Formula >, typename internal::RelationalOpTraits< DerivedA, DerivedB >::ReturnType > operator== (const DerivedA &a1, const DerivedB &a2)
 Returns an Eigen array of symbolic formulas where each element includes element-wise symbolic-equality of two arrays m1 and m2. More...
 
template<typename Derived , typename ScalarType >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename Derived::Scalar()==ScalarType()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator== (const Derived &a, const ScalarType &v)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using equal-to operator (==). More...
 
template<typename ScalarType , typename Derived >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(ScalarType()==typename Derived::Scalar()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator== (const ScalarType &v, const Derived &a)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using equal-to operator (==). More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar()<=typename DerivedB::Scalar()), Formula >, typename internal::RelationalOpTraits< DerivedA, DerivedB >::ReturnType > operator<= (const DerivedA &a1, const DerivedB &a2)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using less-than-or-equal operator (<=). More...
 
template<typename Derived , typename ScalarType >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename Derived::Scalar()<=ScalarType()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator<= (const Derived &a, const ScalarType &v)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using less-than-or-equal operator (<=). More...
 
template<typename ScalarType , typename Derived >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(ScalarType()<=typename Derived::Scalar()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator<= (const ScalarType &v, const Derived &a)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using less-than-or-equal operator (<=). More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar()< typename DerivedB::Scalar()), Formula >, typename internal::RelationalOpTraits< DerivedA, DerivedB >::ReturnType > operator< (const DerivedA &a1, const DerivedB &a2)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using less-than operator (<). More...
 
template<typename Derived , typename ScalarType >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename Derived::Scalar()< ScalarType()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator< (const Derived &a, const ScalarType &v)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using less-than operator (<). More...
 
template<typename ScalarType , typename Derived >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(ScalarType()< typename Derived::Scalar()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator< (const ScalarType &v, const Derived &a)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using less-than operator (<). More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar() >=typename DerivedB::Scalar()), Formula >, typename internal::RelationalOpTraits< DerivedA, DerivedB >::ReturnType > operator>= (const DerivedA &a1, const DerivedB &a2)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using greater-than-or-equal operator (>=). More...
 
template<typename Derived , typename ScalarType >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename Derived::Scalar() >=ScalarType()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator>= (const Derived &a, const ScalarType &v)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using greater-than-or-equal operator (>=). More...
 
template<typename ScalarType , typename Derived >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(ScalarType() >=typename Derived::Scalar()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator>= (const ScalarType &v, const Derived &a)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using less-than-or-equal operator (<=) instead of greater-than-or-equal operator (>=). More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar() > typename DerivedB::Scalar()), Formula >, typename internal::RelationalOpTraits< DerivedA, DerivedB >::ReturnType > operator> (const DerivedA &a1, const DerivedB &a2)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using greater-than operator (>). More...
 
template<typename Derived , typename ScalarType >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename Derived::Scalar() > ScalarType()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator> (const Derived &a, const ScalarType &v)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using greater-than operator (>). More...
 
template<typename ScalarType , typename Derived >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(ScalarType() > typename Derived::Scalar()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator> (const ScalarType &v, const Derived &a)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using less-than operator (<) instead of greater-than operator (>). More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar() !=typename DerivedB::Scalar()), Formula >, typename internal::RelationalOpTraits< DerivedA, DerivedB >::ReturnType > operator!= (const DerivedA &a1, const DerivedB &a2)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using not-equal operator (!=). More...
 
template<typename Derived , typename ScalarType >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(typename Derived::Scalar() !=ScalarType()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator!= (const Derived &a, const ScalarType &v)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using not-equal operator (!=). More...
 
template<typename ScalarType , typename Derived >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< Derived >::XprKind, Eigen::ArrayXpr > &&std::is_same_v< decltype(ScalarType() !=typename Derived::Scalar()), Formula >, Eigen::Array< Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > > operator!= (const ScalarType &v, const Derived &a)
 Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using not-equal operator (!=). More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar()==typename DerivedB::Scalar()), Formula >, Formulaoperator== (const DerivedA &m1, const DerivedB &m2)
 Returns a symbolic formula checking if two matrices m1 and m2 are equal. More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar() !=typename DerivedB::Scalar()), Formula >, Formulaoperator!= (const DerivedA &m1, const DerivedB &m2)
 Returns a symbolic formula representing the condition whether m1 and m2 are not the same. More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar()< typename DerivedB::Scalar()), Formula >, Formulaoperator< (const DerivedA &m1, const DerivedB &m2)
 Returns a symbolic formula representing element-wise comparison between two matrices m1 and m2 using less-than (<) operator. More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar()<=typename DerivedB::Scalar()), Formula >, Formulaoperator<= (const DerivedA &m1, const DerivedB &m2)
 Returns a symbolic formula representing element-wise comparison between two matrices m1 and m2 using less-than-or-equal operator (<=). More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar() > typename DerivedB::Scalar()), Formula >, Formulaoperator> (const DerivedA &m1, const DerivedB &m2)
 Returns a symbolic formula representing element-wise comparison between two matrices m1 and m2 using greater-than operator (>). More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< std::is_same_v< typename Eigen::internal::traits< DerivedA >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< typename Eigen::internal::traits< DerivedB >::XprKind, Eigen::MatrixXpr > &&std::is_same_v< decltype(typename DerivedA::Scalar() >=typename DerivedB::Scalar()), Formula >, Formulaoperator>= (const DerivedA &m1, const DerivedB &m2)
 Returns a symbolic formula representing element-wise comparison between two matrices m1 and m2 using greater-than-or-equal operator (>=). More...
 
bool is_false (const FormulaCell &f)
 Checks if f is structurally equal to False formula. More...
 
bool is_true (const FormulaCell &f)
 Checks if f is structurally equal to True formula. More...
 
bool is_variable (const FormulaCell &f)
 Checks if f is a variable formula. More...
 
bool is_equal_to (const FormulaCell &f)
 Checks if f is a formula representing equality (==). More...
 
bool is_not_equal_to (const FormulaCell &f)
 Checks if f is a formula representing disequality (!=). More...
 
bool is_greater_than (const FormulaCell &f)
 Checks if f is a formula representing greater-than (>). More...
 
bool is_greater_than_or_equal_to (const FormulaCell &f)
 Checks if f is a formula representing greater-than-or-equal-to (>=). More...
 
bool is_less_than (const FormulaCell &f)
 Checks if f is a formula representing less-than (<). More...
 
bool is_less_than_or_equal_to (const FormulaCell &f)
 Checks if f is a formula representing less-than-or-equal-to (<=). More...
 
bool is_relational (const FormulaCell &f)
 Checks if f is a relational formula ({==, !=, >, >=, <, <=}). More...
 
bool is_conjunction (const FormulaCell &f)
 Checks if f is a conjunction (∧). More...
 
bool is_disjunction (const FormulaCell &f)
 Checks if f is a disjunction (∨). More...
 
bool is_negation (const FormulaCell &f)
 Checks if f is a negation (¬). More...
 
bool is_forall (const FormulaCell &f)
 Checks if f is a Forall formula (∀). More...
 
bool is_isnan (const FormulaCell &f)
 Checks if f is an isnan formula. More...
 
bool is_positive_semidefinite (const FormulaCell &f)
 Checks if f is a positive semidefinite formula. More...
 
std::shared_ptr< const FormulaFalseto_false (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaFalse>. More...
 
std::shared_ptr< const FormulaTrueto_true (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaTrue>. More...
 
std::shared_ptr< const FormulaVarto_variable (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaVar>. More...
 
std::shared_ptr< const RelationalFormulaCellto_relational (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const RelationalFormulaCell>. More...
 
std::shared_ptr< const FormulaEqto_equal_to (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaEq>. More...
 
std::shared_ptr< const FormulaNeqto_not_equal_to (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaNeq>. More...
 
std::shared_ptr< const FormulaGtto_greater_than (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaGt>. More...
 
std::shared_ptr< const FormulaGeqto_greater_than_or_equal_to (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaGeq>. More...
 
std::shared_ptr< const FormulaLtto_less_than (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaLt>. More...
 
std::shared_ptr< const FormulaLeqto_less_than_or_equal_to (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaLeq>. More...
 
std::shared_ptr< const FormulaAndto_conjunction (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaAnd>. More...
 
std::shared_ptr< const FormulaOrto_disjunction (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaOr>. More...
 
std::shared_ptr< const NaryFormulaCellto_nary (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const NaryFormulaCell>. More...
 
std::shared_ptr< const FormulaNotto_negation (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaNot>. More...
 
std::shared_ptr< const FormulaForallto_forall (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaForall>. More...
 
std::shared_ptr< const FormulaIsnanto_isnan (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaIsnan>. More...
 
std::shared_ptr< const FormulaPositiveSemidefiniteto_positive_semidefinite (const std::shared_ptr< const FormulaCell > &f_ptr)
 Casts f_ptr to shared_ptr<const FormulaPositiveSemidefinite>. More...
 
template<typename Result , typename Visitor , typename... Args>
Result VisitFormula (Visitor *v, const Formula &f, Args &&... args)
 Calls visitor object v with a symbolic formula f, and arguments args. More...
 
std::ostream & operator<< (std::ostream &os, Variable::Type type)
 
MatrixX< VariableMakeMatrixVariable (int rows, int cols, const std::string &name, Variable::Type type=Variable::Type::CONTINUOUS)
 Creates a dynamically-sized Eigen matrix of symbolic variables. More...
 
MatrixX< VariableMakeMatrixBooleanVariable (int rows, int cols, const std::string &name)
 Creates a dynamically-sized Eigen matrix of symbolic Boolean variables. More...
 
MatrixX< VariableMakeMatrixBinaryVariable (int rows, int cols, const std::string &name)
 Creates a dynamically-sized Eigen matrix of symbolic binary variables. More...
 
MatrixX< VariableMakeMatrixContinuousVariable (int rows, int cols, const std::string &name)
 Creates a dynamically-sized Eigen matrix of symbolic continuous variables. More...
 
MatrixX< VariableMakeMatrixIntegerVariable (int rows, int cols, const std::string &name)
 Creates a dynamically-sized Eigen matrix of symbolic integer variables. More...
 
template<int rows, int cols>
Eigen::Matrix< Variable, rows, cols > MakeMatrixVariable (const std::string &name, Variable::Type type=Variable::Type::CONTINUOUS)
 Creates a static-sized Eigen matrix of symbolic variables. More...
 
template<int rows, int cols>
Eigen::Matrix< Variable, rows, cols > MakeMatrixBooleanVariable (const std::string &name)
 Creates a static-sized Eigen matrix of symbolic Boolean variables. More...
 
template<int rows, int cols>
Eigen::Matrix< Variable, rows, cols > MakeMatrixBinaryVariable (const std::string &name)
 Creates a static-sized Eigen matrix of symbolic binary variables. More...
 
template<int rows, int cols>
Eigen::Matrix< Variable, rows, cols > MakeMatrixContinuousVariable (const std::string &name)
 Creates a static-sized Eigen matrix of symbolic continuous variables. More...
 
template<int rows, int cols>
Eigen::Matrix< Variable, rows, cols > MakeMatrixIntegerVariable (const std::string &name)
 Creates a static-sized Eigen matrix of symbolic integer variables. More...
 
VectorX< VariableMakeVectorVariable (int rows, const std::string &name, Variable::Type type=Variable::Type::CONTINUOUS)
 Creates a dynamically-sized Eigen vector of symbolic variables. More...
 
VectorX< VariableMakeVectorBooleanVariable (int rows, const std::string &name)
 Creates a dynamically-sized Eigen vector of symbolic Boolean variables. More...
 
VectorX< VariableMakeVectorBinaryVariable (int rows, const std::string &name)
 Creates a dynamically-sized Eigen vector of symbolic binary variables. More...
 
VectorX< VariableMakeVectorContinuousVariable (int rows, const std::string &name)
 Creates a dynamically-sized Eigen vector of symbolic continuous variables. More...
 
VectorX< VariableMakeVectorIntegerVariable (int rows, const std::string &name)
 Creates a dynamically-sized Eigen vector of symbolic integer variables. More...
 
template<int rows>
Eigen::Matrix< Variable, rows, 1 > MakeVectorVariable (const std::string &name, Variable::Type type=Variable::Type::CONTINUOUS)
 Creates a static-sized Eigen vector of symbolic variables. More...
 
template<int rows>
Eigen::Matrix< Variable, rows, 1 > MakeVectorBooleanVariable (const std::string &name)
 Creates a static-sized Eigen vector of symbolic Boolean variables. More...
 
template<int rows>
Eigen::Matrix< Variable, rows, 1 > MakeVectorBinaryVariable (const std::string &name)
 Creates a static-sized Eigen vector of symbolic binary variables. More...
 
template<int rows>
Eigen::Matrix< Variable, rows, 1 > MakeVectorContinuousVariable (const std::string &name)
 Creates a static-sized Eigen vector of symbolic continuous variables. More...
 
template<int rows>
Eigen::Matrix< Variable, rows, 1 > MakeVectorIntegerVariable (const std::string &name)
 Creates a static-sized Eigen vector of symbolic integer variables. More...
 
template<typename DerivedA , typename DerivedB >
std::enable_if_t< is_eigen_scalar_same< DerivedA, Variable >::value &&is_eigen_scalar_same< DerivedB, Variable >::value, bool > CheckStructuralEquality (const DerivedA &m1, const DerivedB &m2)
 Checks if two Eigen::Matrix<Variable> m1 and m2 are structurally equal. More...
 
Variablesoperator+= (Variables &vars1, const Variables &vars2)
 Updates var1 with the result of set-union(var1, var2). More...
 
Variablesoperator+= (Variables &vars, const Variable &var)
 Updates vars with the result of set-union(vars, { var }). More...
 
Variables operator+ (Variables vars1, const Variables &vars2)
 Returns set-union of var1 and var2. More...
 
Variables operator+ (Variables vars, const Variable &var)
 Returns set-union of vars and {var}. More...
 
Variables operator+ (const Variable &var, Variables vars)
 Returns set-union of {var} and vars. More...
 
Variablesoperator-= (Variables &vars1, const Variables &vars2)
 Updates var1 with the result of set-minus(var1, var2). More...
 
Variablesoperator-= (Variables &vars, const Variable &var)
 Updates vars with the result of set-minus(vars, {var}). More...
 
Variables operator- (Variables vars1, const Variables &vars2)
 Returns set-minus(var1, vars2). More...
 
Variables operator- (Variables vars, const Variable &var)
 Returns set-minus(vars, { var }). More...
 
Variables intersect (const Variables &vars1, const Variables &vars2)
 Returns the intersection of vars1 and vars2. More...
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (const GenericPolynomial< BasisElement > &p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (GenericPolynomial< BasisElement > p1, const GenericPolynomial< BasisElement > &p2)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (GenericPolynomial< BasisElement > p, const BasisElement &m)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (GenericPolynomial< BasisElement > p, double c)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (const BasisElement &m, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (const BasisElement &m1, const BasisElement &m2)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (const BasisElement &m, double c)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (double c, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (double c, const BasisElement &m)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (GenericPolynomial< BasisElement > p, const Variable &v)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator+ (const Variable &v, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (GenericPolynomial< BasisElement > p1, const GenericPolynomial< BasisElement > &p2)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (GenericPolynomial< BasisElement > p, const BasisElement &m)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (GenericPolynomial< BasisElement > p, double c)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (const BasisElement &m, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (const BasisElement &m1, const BasisElement &m2)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (const BasisElement &m, double c)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (double c, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (double c, const BasisElement &m)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (GenericPolynomial< BasisElement > p, const Variable &v)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator- (const Variable &v, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (GenericPolynomial< BasisElement > p1, const GenericPolynomial< BasisElement > &p2)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (GenericPolynomial< BasisElement > p, const BasisElement &m)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (GenericPolynomial< BasisElement > p, double c)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (const BasisElement &m, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (const BasisElement &m, double c)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (double c, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (double c, const BasisElement &m)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (GenericPolynomial< BasisElement > p, const Variable &v)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator * (const Variable &v, GenericPolynomial< BasisElement > p)
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > operator/ (GenericPolynomial< BasisElement > p, double v)
 Returns p / v. More...
 
template<typename BasisElement >
GenericPolynomialEnable< BasisElement > pow (const GenericPolynomial< BasisElement > &p, int n)
 Returns polynomial raised to n. More...
 
template<typename BasisElement >
std::ostream & operator<< (std::ostream &os, const GenericPolynomial< BasisElement > &p)
 
std::string ToLatex (const Expression &e, int precision=3)
 Generates a LaTeX string representation of e with floating point coefficients displayed using precision. More...
 
std::string ToLatex (const Formula &f, int precision=3)
 Generates a LaTeX string representation of f with floating point coefficients displayed using precision. More...
 
std::string ToLatex (double val, int precision=3)
 Generates a Latex string representation of val displayed with precision, with one exception. More...
 
template<typename Derived >
std::string ToLatex (const Eigen::PlainObjectBase< Derived > &M, int precision=3)
 Generates a LaTeX string representation of M with floating point coefficients displayed using precision. More...
 
std::ostream & operator<< (std::ostream &out, const Monomial &m)
 
Monomial operator * (Monomial m1, const Monomial &m2)
 Returns a multiplication of two monomials, m1 and m2. More...
 
Monomial pow (Monomial m, int p)
 Returns m raised to p. More...
 
std::ostream & operator<< (std::ostream &out, const MonomialBasisElement &m)
 
std::map< MonomialBasisElement, doubleoperator * (const MonomialBasisElement &m1, const MonomialBasisElement &m2)
 Returns a multiplication of two monomials, m1 and m2. More...
 
std::map< MonomialBasisElement, doublepow (MonomialBasisElement m, int p)
 Returns m raised to p. More...
 
Eigen::Matrix< Monomial, Eigen::Dynamic, 1 > MonomialBasis (const Variables &vars, int degree)
 Returns all monomials up to a given degree under the graded reverse lexicographic order. More...
 
constexpr int NChooseK (int n, int k)
 
template<int n, int degree>
Eigen::Matrix< Monomial, NChooseK(n+degree, degree), 1 > MonomialBasis (const Variables &vars)
 Returns all monomials up to a given degree under the graded reverse lexicographic order. More...
 
VectorX< MonomialMonomialBasis (const std::unordered_map< Variables, int > &variables_degree)
 Returns all the monomials (in graded reverse lexicographic order) such that the total degree for each set of variables is no larger than a specific degree. More...
 
Eigen::Matrix< Monomial, Eigen::Dynamic, 1 > EvenDegreeMonomialBasis (const Variables &vars, int degree)
 Returns all even degree monomials up to a given degree under the graded reverse lexicographic order. More...
 
Eigen::Matrix< Monomial, Eigen::Dynamic, 1 > OddDegreeMonomialBasis (const Variables &vars, int degree)
 Returns all odd degree monomials up to a given degree under the graded reverse lexicographic order. More...
 
VectorX< MonomialCalcMonomialBasisOrderUpToOne (const Variables &x, bool sort_monomial=false)
 Generates all the monomials of x, such that the degree for x(i) is no larger than 1 for every x(i) in x. More...
 
Polynomial operator- (const Polynomial &p)
 Unary minus operation for polynomial. More...
 
Polynomial operator+ (Polynomial p1, const Polynomial &p2)
 
Polynomial operator+ (Polynomial p, const Monomial &m)
 
Polynomial operator+ (Polynomial p, double c)
 
Polynomial operator+ (const Monomial &m, Polynomial p)
 
Polynomial operator+ (const Monomial &m1, const Monomial &m2)
 
Polynomial operator+ (const Monomial &m, double c)
 
Polynomial operator+ (double c, Polynomial p)
 
Polynomial operator+ (double c, const Monomial &m)
 
Polynomial operator+ (Polynomial p, const Variable &v)
 
Polynomial operator+ (const Variable &v, Polynomial p)
 
Expression operator+ (const Expression &e, const Polynomial &p)
 
Expression operator+ (const Polynomial &p, const Expression &e)
 
Polynomial operator- (Polynomial p1, const Polynomial &p2)
 
Polynomial operator- (Polynomial p, const Monomial &m)
 
Polynomial operator- (Polynomial p, double c)
 
Polynomial operator- (const Monomial &m, Polynomial p)
 
Polynomial operator- (const Monomial &m1, const Monomial &m2)
 
Polynomial operator- (const Monomial &m, double c)
 
Polynomial operator- (double c, Polynomial p)
 
Polynomial operator- (double c, const Monomial &m)
 
Polynomial operator- (Polynomial p, const Variable &v)
 
Polynomial operator- (const Variable &v, const Polynomial &p)
 
Expression operator- (const Expression &e, const Polynomial &p)
 
Expression operator- (const Polynomial &p, const Expression &e)
 
Polynomial operator * (Polynomial p1, const Polynomial &p2)
 
Polynomial operator * (Polynomial p, const Monomial &m)
 
Polynomial operator * (Polynomial p, double c)
 
Polynomial operator * (const Monomial &m, Polynomial p)
 
Polynomial operator * (const Monomial &m, double c)
 
Polynomial operator * (double c, Polynomial p)
 
Polynomial operator * (double c, const Monomial &m)
 
Polynomial operator * (Polynomial p, const Variable &v)
 
Polynomial operator * (const Variable &v, Polynomial p)
 
Expression operator * (const Expression &e, const Polynomial &p)
 
Expression operator * (const Polynomial &p, const Expression &e)
 
Polynomial operator/ (Polynomial p, double v)
 Returns p / v. More...
 
Expression operator/ (double v, const Polynomial &p)
 
Expression operator/ (const Expression &e, const Polynomial &p)
 
Expression operator/ (const Polynomial &p, const Expression &e)
 
Polynomial pow (const Polynomial &p, int n)
 Returns polynomial p raised to n. More...
 
std::ostream & operator<< (std::ostream &os, const Polynomial &p)
 
template<typename MatrixL , typename MatrixR >
Eigen::Matrix< Polynomial, MatrixL::RowsAtCompileTime, MatrixR::ColsAtCompileTime > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following matrix operations: More...
 
template<typename Derived >
std::enable_if_t< std::is_same_v< typename Derived::Scalar, Polynomial >, MatrixLikewise< double, Derived > > Evaluate (const Eigen::MatrixBase< Derived > &m, const Environment &env)
 Evaluates a matrix m of symbolic polynomials using env. More...
 
MatrixX< PolynomialJacobian (const Eigen::Ref< const VectorX< Polynomial >> &f, const Eigen::Ref< const VectorX< Variable >> &vars)
 Computes the Jacobian matrix J of the vector function f with respect to vars. More...
 
template<typename Derived1 , typename Derived2 >
std::enable_if< is_eigen_vector_of< Derived1, symbolic::Monomial >::value &&(is_eigen_vector_of< Derived2, double >::value||is_eigen_vector_of< Derived2, symbolic::Variable >::value||is_eigen_vector_of< Derived2, symbolic::Expression >::value), symbolic::Polynomial >::type CalcPolynomialWLowerTriangularPart (const Eigen::MatrixBase< Derived1 > &monomial_basis, const Eigen::MatrixBase< Derived2 > &gram_lower)
 Returns the polynomial m(x)ᵀ * Q * m(x), where m(x) is the monomial basis, and Q is the Gram matrix. More...
 
template<int rows, typename BasisElement >
Eigen::Matrix< BasisElement, rows, 1 > ComputePolynomialBasisUpToDegree (const Variables &vars, int degree, internal::DegreeType degree_type)
 Returns all polynomial basis elements up to a given degree under the graded reverse lexicographic order. More...
 
RationalFunction operator+ (RationalFunction f1, const RationalFunction &f2)
 
RationalFunction operator+ (RationalFunction f, const Polynomial &p)
 
RationalFunction operator+ (const Polynomial &p, RationalFunction f)
 
RationalFunction operator+ (const Monomial &m, RationalFunction f)
 
RationalFunction operator+ (RationalFunction f, const Monomial &m)
 
RationalFunction operator+ (RationalFunction f, double c)
 
RationalFunction operator+ (double c, RationalFunction f)
 
RationalFunction operator- (RationalFunction f1, const RationalFunction &f2)
 
RationalFunction operator- (RationalFunction f, const Polynomial &p)
 
RationalFunction operator- (const Polynomial &p, const RationalFunction &f)
 
RationalFunction operator- (RationalFunction f, double c)
 
RationalFunction operator- (double c, RationalFunction f)
 
RationalFunction operator- (const Monomial &m, RationalFunction f)
 
RationalFunction operator- (RationalFunction f, const Monomial &m)
 
RationalFunction operator * (RationalFunction f1, const RationalFunction &f2)
 
RationalFunction operator * (RationalFunction f, const Polynomial &p)
 
RationalFunction operator * (const Polynomial &p, RationalFunction f)
 
RationalFunction operator * (RationalFunction f, double c)
 
RationalFunction operator * (double c, RationalFunction f)
 
RationalFunction operator * (const Monomial &m, RationalFunction f)
 
RationalFunction operator * (RationalFunction f, const Monomial &m)
 
RationalFunction operator/ (RationalFunction f1, const RationalFunction &f2)
 
RationalFunction operator/ (RationalFunction f, const Polynomial &p)
 
RationalFunction operator/ (const Polynomial &p, const RationalFunction &f)
 
RationalFunction operator/ (RationalFunction f, double c)
 
RationalFunction operator/ (double c, const RationalFunction &f)
 
RationalFunction operator/ (const Monomial &m, RationalFunction f)
 
RationalFunction operator/ (RationalFunction f, const Monomial &m)
 
RationalFunction pow (const RationalFunction &f, int n)
 Returns the rational function f raised to n. More...
 
template<typename MatrixL , typename MatrixR >
Eigen::Matrix< RationalFunction, MatrixL::RowsAtCompileTime, MatrixR::ColsAtCompileTime > operator * (const MatrixL &lhs, const MatrixR &rhs)
 Provides the following operations: More...
 
symbolic::Expression ReplaceBilinearTerms (const symbolic::Expression &e, const Eigen::Ref< const VectorX< symbolic::Variable >> &x, const Eigen::Ref< const VectorX< symbolic::Variable >> &y, const Eigen::Ref< const MatrixX< symbolic::Expression >> &W)
 Replaces all the bilinear product terms in the expression e, with the corresponding terms in W, where W represents the matrix x * yᵀ, such that after replacement, e does not have bilinear terms involving x and y. More...
 
Rewriter MakeRuleRewriter (const RewritingRule &r)
 Constructs a rewriter based on a rewriting rule r. More...
 
Expression Substitute (const Expression &e, const SinCosSubstitution &subs)
 Given a substitution map q => {s, c}, substitutes instances of sin(q) and cos(q) in e with s and c, with partial support for trigonometric expansions. More...
 
template<typename Derived >
MatrixLikewise< Expression, Derived > Substitute (const Eigen::MatrixBase< Derived > &m, const SinCosSubstitution &subs)
 Matrix version of sin/cos substitution. More...
 
symbolic::RationalFunction SubstituteStereographicProjection (const symbolic::Polynomial &e, const std::vector< SinCos > &sin_cos, const VectorX< symbolic::Variable > &t)
 Substitutes the variables representing sine and cosine functions with their stereographic projection. More...
 

Typedef Documentation

◆ GenericPolynomialEnable

using GenericPolynomialEnable = std::enable_if_t<std::is_base_of_v<PolynomialBasisElement, BasisElement>, GenericPolynomial<BasisElement> >

Defines an explicit SFINAE alias for use with return types to dissuade CTAD from trying to instantiate an invalid GenericElement<> for operator overloads, (if that's actually the case).

See discussion for more info: https://github.com/robotlocomotion/drake/pull/14053#pullrequestreview-488744679

◆ Pattern

A pattern is an expression which possibly includes variables which represent placeholders.

It is used to construct a RewritingRule.

◆ Rewriter

using Rewriter = std::function<Expression(const Expression&)>

A Rewriter is a function from an Expression to an Expression.

◆ SinCosSubstitution

using SinCosSubstitution = std::unordered_map<Variable, SinCos>

◆ Substitution

using Substitution = std::unordered_map<Variable, Expression>

Enumeration Type Documentation

◆ ExpressionKind

enum ExpressionKind : std::uint16_t
strong

Kinds of symbolic expressions.

Enumerator
Constant 

constant (double)

Var 

variable

Add 

addition (+)

Mul 

multiplication (*)

Div 

division (/)

Log 

logarithms

Abs 

absolute value function

Exp 

exponentiation

Sqrt 

square root

Pow 

power function

Sin 

sine

Cos 

cosine

Tan 

tangent

Asin 

arcsine

Acos 

arccosine

Atan 

arctangent

Atan2 

arctangent2 (atan2(y,x) = atan(y/x))

Sinh 

hyperbolic sine

Cosh 

hyperbolic cosine

Tanh 

hyperbolic tangent

Min 

min

Max 

max

Ceil 

ceil

Floor 

floor

IfThenElse 

if then else

NaN 

NaN.

UninterpretedFunction 

Uninterpreted function.

◆ FormulaKind

enum FormulaKind
strong

Kinds of symbolic formulas.

Enumerator
False 

True 

Var 

Boolean Variable.

Eq 

=

Neq 

!=

Gt 

>

Geq 

>=

Lt 

<

Leq 

<=

And 

Conjunction (∧)

Or 

Disjunction (∨)

Not 

Negation (¬)

Forall 

Universal quantification (∀)

Isnan 

NaN check predicate.

PositiveSemidefinite 

Positive semidefinite matrix.

◆ SinCosSubstitutionType

Enumerator
kAngle 

Substitutes s <=> sin(q), c <=> cos(q).

kHalfAnglePreferSin 

Substitutes s <=> sin(q/2), c <=> cos(q/2), and prefers sin when the choice is ambiguous; e.g.

cos(q) => 1 - 2s².

kHalfAnglePreferCos 

Substitutes s <=> sin(q/2), c <=> cos(q/2), and prefers cos when the choice is ambiguous; e.g.

cos(q) => 2c² - 1.

Function Documentation

◆ abs()

Expression drake::symbolic::abs ( const Expression e)

◆ acos()

Expression drake::symbolic::acos ( const Expression e)

◆ asin()

Expression drake::symbolic::asin ( const Expression e)

◆ atan()

Expression drake::symbolic::atan ( const Expression e)

◆ atan2()

Expression drake::symbolic::atan2 ( const Expression e1,
const Expression e2 
)

◆ CalcMonomialBasisOrderUpToOne()

VectorX<Monomial> drake::symbolic::CalcMonomialBasisOrderUpToOne ( const Variables x,
bool  sort_monomial = false 
)

Generates all the monomials of x, such that the degree for x(i) is no larger than 1 for every x(i) in x.

Parameters
xThe variables whose monomials are generated.
sort_monomialIf true, the returned monomials are sorted in the graded reverse lexicographic order. For example if x = (x₀, x₁) with x₀< x₁, then this function returns [x₀x₁, x₁, x₀, 1]. If sort_monomial=false, then we return the monomials in an arbitrary order.

◆ CalcPolynomialWLowerTriangularPart()

std::enable_if< is_eigen_vector_of<Derived1, symbolic::Monomial>::value && (is_eigen_vector_of<Derived2, double>::value || is_eigen_vector_of<Derived2, symbolic::Variable>::value || is_eigen_vector_of<Derived2, symbolic::Expression>::value), symbolic::Polynomial>::type drake::symbolic::CalcPolynomialWLowerTriangularPart ( const Eigen::MatrixBase< Derived1 > &  monomial_basis,
const Eigen::MatrixBase< Derived2 > &  gram_lower 
)

Returns the polynomial m(x)ᵀ * Q * m(x), where m(x) is the monomial basis, and Q is the Gram matrix.

Parameters
monomial_basism(x) in the documentation. A vector of monomials.
gram_lowerThe lower triangular entries in Q, stacked columnwise into a vector.

◆ ceil()

Expression drake::symbolic::ceil ( const Expression e)

◆ CheckStructuralEquality() [1/2]

std::enable_if_t<is_eigen_scalar_same<DerivedA, Variable>::value && is_eigen_scalar_same<DerivedB, Variable>::value, bool> drake::symbolic::CheckStructuralEquality ( const DerivedA &  m1,
const DerivedB &  m2 
)

Checks if two Eigen::Matrix<Variable> m1 and m2 are structurally equal.

That is, it returns true if and only if m1(i, j) is structurally equal to m2(i, j) for all i, j.

◆ CheckStructuralEquality() [2/2]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<DerivedA>, DerivedA> && std::is_base_of_v<Eigen::MatrixBase<DerivedB>, DerivedB> && std::is_same_v<typename DerivedA::Scalar, Expression> && std::is_same_v<typename DerivedB::Scalar, Expression>, bool> drake::symbolic::CheckStructuralEquality ( const DerivedA &  m1,
const DerivedB &  m2 
)

Checks if two Eigen::Matrix<Expression> m1 and m2 are structurally equal.

That is, it returns true if and only if m1(i, j) is structurally equal to m2(i, j) for all i, j.

◆ clamp()

Expression drake::symbolic::clamp ( const Expression v,
const Expression lo,
const Expression hi 
)

◆ ComputePolynomialBasisUpToDegree()

Eigen::Matrix<BasisElement, rows, 1> drake::symbolic::ComputePolynomialBasisUpToDegree ( const Variables vars,
int  degree,
internal::DegreeType  degree_type 
)

Returns all polynomial basis elements up to a given degree under the graded reverse lexicographic order.

Template Parameters
rowsNumber of rows or Eigen::Dynamic.
BasisElementA derived class of PolynomialBasisElement.
Parameters
varsThe variables appearing in the polynomial basis.
degreeThe highest total degree of the polynomial basis elements.
degree_typeIf degree_type is kAny, then the polynomial basis elements' degrees are no larger than degree. If degree_type is kEven, then the elements' degrees are even numbers no larger than degree. If degree_type is kOdd, then the elements' degrees are odd numbers no larger than degree. TODO(hongkai.dai): this will replace ComputeMonomialBasis in monomial_util.h.

◆ cos()

Expression drake::symbolic::cos ( const Expression e)

◆ cosh()

Expression drake::symbolic::cosh ( const Expression e)

◆ DecomposeAffineExpression()

int drake::symbolic::DecomposeAffineExpression ( const symbolic::Expression e,
const std::unordered_map< symbolic::Variable::Id, int > &  map_var_to_index,
EigenPtr< Eigen::RowVectorXd >  coeffs,
double constant_term 
)

Decomposes an affine combination e = c0 + c1 * v1 + ...

cn * vn into the following:

 constant term      : c0
 coefficient vector : [c1, ..., cn]
 variable vector    : [v1, ..., vn]

Then, it extracts the coefficient and the constant term. A map from variable ID to int, map_var_to_index, is used to decide a variable's index in a linear combination.

Precondition
  1. coeffs is a row vector of double, whose length matches with the size of map_var_to_index.
  2. e.is_polynomial() is true.
  3. e is an affine expression.
  4. all values in map_var_to_index should be in the range [0, map_var_to_index.size())
Parameters
[in]eThe symbolic affine expression
[in]map_var_to_indexA mapping from variable ID to variable index, such that map_var_to_index[vi.get_ID()] = i.
[out]coeffsA row vector. coeffs(i) = ci.
[out]constant_termc0 in the equation above.
Returns
num_variable. Number of variables in the expression. 2 * x(0) + 3 has 1 variable, 2 * x(0) + 3 * x(1) - 2 * x(0) has 1 variable.

◆ DecomposeAffineExpressions() [1/2]

void drake::symbolic::DecomposeAffineExpressions ( const Eigen::Ref< const VectorX< Expression >> &  expressions,
const Eigen::Ref< const VectorX< Variable >> &  vars,
EigenPtr< Eigen::MatrixXd >  M,
EigenPtr< Eigen::VectorXd >  v 
)

Decomposes expressions into M * vars + v.

Exceptions
std::exceptionif expressions is not affine in vars.
Precondition
M.rows() == expressions.rows() && M.cols() == vars.rows().
v.rows() == expressions.rows().

◆ DecomposeAffineExpressions() [2/2]

void drake::symbolic::DecomposeAffineExpressions ( const Eigen::Ref< const VectorX< symbolic::Expression >> &  v,
Eigen::MatrixXd *  A,
Eigen::VectorXd *  b,
VectorX< Variable > *  vars 
)

Given a vector of affine expressions v, decompose it to \( v = A vars + b \).

Parameters
[in]vA vector of affine expressions
[out]AThe matrix containing the linear coefficients.
[out]bThe vector containing all the constant terms.
[out]varsAll variables.

◆ DecomposeLinearExpressions()

void drake::symbolic::DecomposeLinearExpressions ( const Eigen::Ref< const VectorX< Expression >> &  expressions,
const Eigen::Ref< const VectorX< Variable >> &  vars,
EigenPtr< Eigen::MatrixXd >  M 
)

Decomposes expressions into M * vars.

Exceptions
std::exceptionif expressions is not linear in vars.
Precondition
M.rows() == expressions.rows() && M.cols() == vars.rows().

◆ DecomposeLumpedParameters()

std::tuple<MatrixX<Expression>, VectorX<Expression>, VectorX<Expression> > drake::symbolic::DecomposeLumpedParameters ( const Eigen::Ref< const VectorX< Expression >> &  f,
const Eigen::Ref< const VectorX< Variable >> &  parameters 
)

Given a vector of Expressions f and a list of parameters we define all additional variables in f to be a vector of "non-parameter variables", n.

This method returns a factorization of f into an equivalent "data matrix", W, which depends only on the non-parameter variables, and a "lumped parameter vector", α, which depends only on parameters: f = W(n)*α(parameters) + w0(n).

Note
The current implementation makes some simple attempts to minimize the number of lumped parameters, but more simplification could be implemented relatively easily. Optimal simplification, however, involves the complexity of comparing two arbitrary Expressions (see Expression::EqualTo for more details).
Exceptions
std::exceptionif f is not decomposable in this way (cells containing parameters may only be added or multiplied with cells containing non-parameter variables).
Returns
W(n), α(parameters), and w0(n).

◆ DecomposeQuadraticPolynomial()

void drake::symbolic::DecomposeQuadraticPolynomial ( const symbolic::Polynomial poly,
const std::unordered_map< symbolic::Variable::Id, int > &  map_var_to_index,
Eigen::MatrixXd *  Q,
Eigen::VectorXd *  b,
double c 
)

Given a quadratic polynomial poly, decomposes it into the form 0.5 * x' Q * x + b' * x + c.

Parameters
[in]polyQuadratic polynomial to decompose.
[in]map_var_to_indexmaps variables in poly.GetVariables() to the index in the vector x.
Q[out]The Hessian of the quadratic expression.
Precondition
The size of Q should be num_variables x num_variables. Q is a symmetric matrix.
Parameters
b[out]The linear term of the quadratic expression.
Precondition
The size of b should be num_variables.
Parameters
c[out]The constant term of the quadratic expression.

◆ Evaluate() [1/3]

std::enable_if_t< std::is_same_v<typename Derived::Scalar, Polynomial>, MatrixLikewise<double, Derived> > drake::symbolic::Evaluate ( const Eigen::MatrixBase< Derived > &  m,
const Environment env 
)

Evaluates a matrix m of symbolic polynomials using env.

Returns
a matrix of double whose size is the size of m.
Exceptions
std::exceptionif NaN is detected during evaluation.

◆ Evaluate() [2/3]

std::enable_if_t<std::is_same_v<typename Derived::Scalar, Expression>, MatrixLikewise<double, Derived> > drake::symbolic::Evaluate ( const Eigen::MatrixBase< Derived > &  m,
const Environment env = Environment{},
RandomGenerator random_generator = nullptr 
)

Evaluates a symbolic matrix m using env and random_generator.

If there is a random variable in m which is unassigned in env, this function uses random_generator to sample a value and use the value to substitute all occurrences of the random variable in m.

Returns
a matrix of double whose size is the size of m.
Exceptions
std::exceptionif NaN is detected during evaluation.
std::exceptionif m includes unassigned random variables but random_generator is nullptr.

◆ Evaluate() [3/3]

Eigen::SparseMatrix<double> drake::symbolic::Evaluate ( const Eigen::Ref< const Eigen::SparseMatrix< Expression >> &  m,
const Environment env = Environment{} 
)

Evaluates m using a given environment (by default, an empty environment).

Exceptions
std::exceptionif there exists a variable in m whose value is not provided by env.
std::exceptionif NaN is detected during evaluation.

◆ EvaluateChebyshevPolynomial()

double drake::symbolic::EvaluateChebyshevPolynomial ( double  var_val,
int  degree 
)

Evaluates a Chebyshev polynomial at a given value.

Parameters
var_valThe value of the variable.
degreeThe degree of the Chebyshev polynomial.

◆ EvenDegreeMonomialBasis()

Eigen::Matrix<Monomial, Eigen::Dynamic, 1> drake::symbolic::EvenDegreeMonomialBasis ( const Variables vars,
int  degree 
)

Returns all even degree monomials up to a given degree under the graded reverse lexicographic order.

A monomial has an even degree if its total degree is even. So xy is an even degree monomial (degree 2) while x²y is not (degree 3). Note that graded reverse lexicographic order uses the total order among Variable which is based on a variable's unique ID. For example, for a given variable ordering x > y > z, EvenDegreeMonomialBasis({x, y, z}, 2) returns a column vector [x², xy, y², xz, yz, z², 1].

Precondition
vars is a non-empty set.
degree is a non-negative integer.

◆ exp()

Expression drake::symbolic::exp ( const Expression e)

◆ ExtractAndAppendVariablesFromExpression()

void drake::symbolic::ExtractAndAppendVariablesFromExpression ( const symbolic::Expression e,
VectorX< Variable > *  vars,
std::unordered_map< symbolic::Variable::Id, int > *  map_var_to_index 
)

Given an expression e, extract all variables inside e, append these variables to vars if they are not included in vars yet.

Parameters
[in]eA symbolic expression.
[in,out]varsAs an input, vars contain the variables before extracting expression e. As an output, the variables in e that were not included in vars, will be appended to the end of vars.
[in,out]map_var_to_index.map_var_to_index is of the same size as vars, and map_var_to_index[vars(i).get_id()] = i. This invariance holds for map_var_to_index both as the input and as the output.
Note
This function is very slow if you call this function within a loop as it involves repeated heap memory allocation. Consider using ExtractVariablesFromExpression.

◆ ExtractVariablesFromExpression() [1/2]

std::pair<VectorX<Variable>, std::unordered_map<symbolic::Variable::Id, int> > drake::symbolic::ExtractVariablesFromExpression ( const symbolic::Expression e)

Given an expression e, extracts all variables inside e.

Parameters
[in]eA symbolic expression.
Return values
pairpair.first is the variables in e. pair.second is the mapping from the variable ID to the index in pair.first, such that pair.second[pair.first(i).get_id()] = i

◆ ExtractVariablesFromExpression() [2/2]

std::pair<VectorX<Variable>, std::unordered_map<Variable::Id, int> > drake::symbolic::ExtractVariablesFromExpression ( const Eigen::Ref< const VectorX< Expression >> &  expressions)

Overloads ExtractVariablesFromExpression but with a vector of expressions.

◆ floor()

Expression drake::symbolic::floor ( const Expression e)

◆ forall()

Formula drake::symbolic::forall ( const Variables vars,
const Formula f 
)

Returns a formula f, universally quantified by variables vars.

◆ get_argument()

const Expression& drake::symbolic::get_argument ( const Expression e)

Returns the argument in the unary expression e.

Precondition
{e is a unary expression.}

◆ get_base_to_exponent_map_in_multiplication()

const std::map<Expression, Expression>& drake::symbolic::get_base_to_exponent_map_in_multiplication ( const Expression e)

Returns the map from a base expression to its exponent expression in the multiplication expression e.

For instance, given 7 * x^2 * y^3 * z^x, the return value maps 'x' to 2, 'y' to 3, and 'z' to 'x'.

Precondition
{e is a multiplication expression.}

◆ get_conditional_formula()

const Formula& drake::symbolic::get_conditional_formula ( const Expression e)

Returns the conditional formula in the if-then-else expression e.

Precondition
e is an if-then-else expression.

◆ get_constant_in_addition()

double drake::symbolic::get_constant_in_addition ( const Expression e)

Returns the constant part of the addition expression e.

For instance, given 7 + 2 * x + 3 * y, it returns 7.

Precondition
{e is an addition expression.}

◆ get_constant_in_multiplication()

double drake::symbolic::get_constant_in_multiplication ( const Expression e)

Returns the constant part of the multiplication expression e.

For instance, given 7 * x^2 * y^3, it returns 7.

Precondition
{e is a multiplication expression.}

◆ get_constant_value()

double drake::symbolic::get_constant_value ( const Expression e)

Returns the constant value of the constant expression e.

Precondition
{e is a constant expression.}

◆ get_else_expression()

const Expression& drake::symbolic::get_else_expression ( const Expression e)

Returns the 'else' expression in the if-then-else expression e.

Precondition
e is an if-then-else expression.

◆ get_expr_to_coeff_map_in_addition()

const std::map<Expression, double>& drake::symbolic::get_expr_to_coeff_map_in_addition ( const Expression e)

Returns the map from an expression to its coefficient in the addition expression e.

For instance, given 7 + 2 * x + 3 * y, the return value maps 'x' to 2 and 'y' to 3.

Precondition
{e is an addition expression.}

◆ get_first_argument()

const Expression& drake::symbolic::get_first_argument ( const Expression e)

Returns the first argument of the binary expression e.

Precondition
{e is a binary expression.}

◆ get_lhs_expression()

const Expression& drake::symbolic::get_lhs_expression ( const Formula f)

Returns the lhs-argument of a relational formula f.

Precondition
{f is a relational formula.}

◆ get_matrix_in_positive_semidefinite()

const MatrixX<Expression>& drake::symbolic::get_matrix_in_positive_semidefinite ( const Formula f)

Returns the matrix in a positive-semidefinite formula f.

Precondition
{f is a positive-semidefinite formula.}

◆ get_operand()

const Formula& drake::symbolic::get_operand ( const Formula f)

Returns the formula in a negation formula f.

Precondition
{f is a negation formula.}

◆ get_operands()

const std::set<Formula>& drake::symbolic::get_operands ( const Formula f)

Returns the set of formulas in a n-ary formula f.

Precondition
{f is a n-ary formula.}

◆ get_quantified_formula()

const Formula& drake::symbolic::get_quantified_formula ( const Formula f)

Returns the quantified formula in a forall formula f.

Precondition
{f is a forall formula.}

◆ get_quantified_variables()

const Variables& drake::symbolic::get_quantified_variables ( const Formula f)

Returns the quantified variables in a forall formula f.

Precondition
{f is a forall formula.}

◆ get_rhs_expression()

const Expression& drake::symbolic::get_rhs_expression ( const Formula f)

Returns the rhs-argument of a relational formula f.

Precondition
{f is a relational formula.}

◆ get_second_argument()

const Expression& drake::symbolic::get_second_argument ( const Expression e)

Returns the second argument of the binary expression e.

Precondition
{e is a binary expression.}

◆ get_then_expression()

const Expression& drake::symbolic::get_then_expression ( const Expression e)

Returns the 'then' expression in the if-then-else expression e.

Precondition
e is an if-then-else expression.

◆ get_unary_expression()

const Expression& drake::symbolic::get_unary_expression ( const Formula f)

Returns the expression in a unary expression formula f.

Currently, an isnan() formula is the only kind of unary expression formula.

Precondition
{f is a unary expression formula.}

◆ get_uninterpreted_function_arguments()

const std::vector<Expression>& drake::symbolic::get_uninterpreted_function_arguments ( const Expression e)

Returns the arguments of an uninterpreted-function expression e.

Precondition
e is an uninterpreted-function expression.

◆ get_uninterpreted_function_name()

const std::string& drake::symbolic::get_uninterpreted_function_name ( const Expression e)

Returns the name of an uninterpreted-function expression e.

Precondition
e is an uninterpreted-function expression.

◆ get_variable() [1/2]

const Variable& drake::symbolic::get_variable ( const Formula f)

Returns the embedded variable in the variable formula f.

Precondition
f is a variable formula.

◆ get_variable() [2/2]

const Variable& drake::symbolic::get_variable ( const Expression e)

Returns the embedded variable in the variable expression e.

Precondition
{e is a variable expression.}

◆ GetDistinctVariables()

Variables drake::symbolic::GetDistinctVariables ( const Eigen::Ref< const MatrixX< Expression >> &  v)

Returns the distinct variables in the matrix of expressions.

◆ GetVariableVector()

VectorX<Variable> drake::symbolic::GetVariableVector ( const Eigen::Ref< const VectorX< Expression >> &  expressions)

Constructs a vector of variables from the vector of variable expressions.

Exceptions
std::exceptionif there is an expression in vec which is not a variable.

◆ if_then_else()

Expression drake::symbolic::if_then_else ( const Formula f_cond,
const Expression e_then,
const Expression e_else 
)
  if_then_else(cond, expr_then, expr_else)

The value returned by the above if-then-else expression is expr_then if cond is evaluated to true. Otherwise, it returns expr_else.

The semantics is similar to the C++'s conditional expression constructed by its ternary operator, ?:. However, there is a key difference between the C++'s conditional expression and our if_then_else expression in a way the arguments are evaluated during the construction.

  • In case of the C++'s conditional expression, cond ? expr_then : expr_else, the then expression expr_then (respectively, the else expression expr_else) is only evaluated when the conditional expression cond is evaluated to true (respectively, when cond is evaluated to false).
  • In case of the symbolic expression, if_then_else(cond, expr_then, expr_else), however, both arguments expr_then and expr_else are evaluated first and then passed to the if_then_else function.
Note
This function returns an expression and it is different from the C++'s if-then-else statement.
While it is still possible to define min, max, abs math functions using if_then_else expression, it is highly recommended to use the provided native definitions for them because it allows solvers to detect specific math functions and to have a room for special optimizations.
More information about the C++'s conditional expression and ternary operator is available at http://en.cppreference.com/w/cpp/language/operator_other#Conditional_operator.

◆ intersect()

Variables drake::symbolic::intersect ( const Variables vars1,
const Variables vars2 
)

Returns the intersection of vars1 and vars2.

This function has a time complexity of O(N₁ + N₂) where N₁ and N₂ are the size of vars1 and vars2 respectively.

◆ is_abs() [1/2]

bool drake::symbolic::is_abs ( const Expression e)

Checks if e is an abs expression.

◆ is_abs() [2/2]

bool drake::symbolic::is_abs ( const ExpressionCell c)

Checks if c is an absolute-value-function expression.

◆ is_acos() [1/2]

bool drake::symbolic::is_acos ( const Expression e)

Checks if e is an arccosine expression.

◆ is_acos() [2/2]

bool drake::symbolic::is_acos ( const ExpressionCell c)

Checks if c is an arccosine expression.

◆ is_addition() [1/2]

bool drake::symbolic::is_addition ( const Expression e)

Checks if e is an addition expression.

◆ is_addition() [2/2]

bool drake::symbolic::is_addition ( const ExpressionCell c)

Checks if c is an addition expression.

◆ is_asin() [1/2]

bool drake::symbolic::is_asin ( const Expression e)

Checks if e is an arcsine expression.

◆ is_asin() [2/2]

bool drake::symbolic::is_asin ( const ExpressionCell c)

Checks if c is an arcsine expression.

◆ is_atan() [1/2]

bool drake::symbolic::is_atan ( const Expression e)

Checks if e is an arctangent expression.

◆ is_atan() [2/2]

bool drake::symbolic::is_atan ( const ExpressionCell c)

Checks if c is an arctangent expression.

◆ is_atan2() [1/2]

bool drake::symbolic::is_atan2 ( const Expression e)

Checks if e is an arctangent2 expression.

◆ is_atan2() [2/2]

bool drake::symbolic::is_atan2 ( const ExpressionCell c)

Checks if c is a arctangent2 expression.

◆ is_binary()

bool drake::symbolic::is_binary ( const ExpressionCell c)

Checks if c is a binary expression.

◆ is_ceil() [1/2]

bool drake::symbolic::is_ceil ( const Expression e)

Checks if e is a ceil expression.

◆ is_ceil() [2/2]

bool drake::symbolic::is_ceil ( const ExpressionCell c)

Checks if c is a ceil expression.

◆ is_conjunction() [1/2]

bool drake::symbolic::is_conjunction ( const Formula f)

Checks if f is a conjunction (∧).

◆ is_conjunction() [2/2]

bool drake::symbolic::is_conjunction ( const FormulaCell f)

Checks if f is a conjunction (∧).

◆ is_constant() [1/2]

bool drake::symbolic::is_constant ( const Expression e)

Checks if e is a constant expression.

◆ is_constant() [2/2]

bool drake::symbolic::is_constant ( const Expression e,
double  v 
)

Checks if e is a constant expression representing v.

◆ is_cos() [1/2]

bool drake::symbolic::is_cos ( const Expression e)

Checks if e is a cosine expression.

◆ is_cos() [2/2]

bool drake::symbolic::is_cos ( const ExpressionCell c)

Checks if c is a cosine expression.

◆ is_cosh() [1/2]

bool drake::symbolic::is_cosh ( const Expression e)

Checks if e is a hyperbolic-cosine expression.

◆ is_cosh() [2/2]

bool drake::symbolic::is_cosh ( const ExpressionCell c)

Checks if c is a hyperbolic-cosine expression.

◆ is_disjunction() [1/2]

bool drake::symbolic::is_disjunction ( const Formula f)

Checks if f is a disjunction (∨).

◆ is_disjunction() [2/2]

bool drake::symbolic::is_disjunction ( const FormulaCell f)

Checks if f is a disjunction (∨).

◆ is_division() [1/2]

bool drake::symbolic::is_division ( const Expression e)

Checks if e is a division expression.

◆ is_division() [2/2]

bool drake::symbolic::is_division ( const ExpressionCell c)

Checks if c is a division expression.

◆ is_equal_to() [1/2]

bool drake::symbolic::is_equal_to ( const Formula f)

Checks if f is a formula representing equality (==).

◆ is_equal_to() [2/2]

bool drake::symbolic::is_equal_to ( const FormulaCell f)

Checks if f is a formula representing equality (==).

◆ is_exp() [1/2]

bool drake::symbolic::is_exp ( const Expression e)

Checks if e is an exp expression.

◆ is_exp() [2/2]

bool drake::symbolic::is_exp ( const ExpressionCell c)

Checks if c is an exp expression.

◆ is_false() [1/2]

bool drake::symbolic::is_false ( const Formula f)

Checks if f is structurally equal to False formula.

◆ is_false() [2/2]

bool drake::symbolic::is_false ( const FormulaCell f)

Checks if f is structurally equal to False formula.

◆ is_floor() [1/2]

bool drake::symbolic::is_floor ( const Expression e)

Checks if e is a floor expression.

◆ is_floor() [2/2]

bool drake::symbolic::is_floor ( const ExpressionCell c)

Checks if c is a floor expression.

◆ is_forall() [1/2]

bool drake::symbolic::is_forall ( const Formula f)

Checks if f is a Forall formula (∀).

◆ is_forall() [2/2]

bool drake::symbolic::is_forall ( const FormulaCell f)

Checks if f is a Forall formula (∀).

◆ is_greater_than() [1/2]

bool drake::symbolic::is_greater_than ( const Formula f)

Checks if f is a formula representing greater-than (>).

◆ is_greater_than() [2/2]

bool drake::symbolic::is_greater_than ( const FormulaCell f)

Checks if f is a formula representing greater-than (>).

◆ is_greater_than_or_equal_to() [1/2]

bool drake::symbolic::is_greater_than_or_equal_to ( const Formula f)

Checks if f is a formula representing greater-than-or-equal-to (>=).

◆ is_greater_than_or_equal_to() [2/2]

bool drake::symbolic::is_greater_than_or_equal_to ( const FormulaCell f)

Checks if f is a formula representing greater-than-or-equal-to (>=).

◆ is_if_then_else() [1/2]

bool drake::symbolic::is_if_then_else ( const Expression e)

Checks if e is an if-then-else expression.

◆ is_if_then_else() [2/2]

bool drake::symbolic::is_if_then_else ( const ExpressionCell c)

Checks if c is an if-then-else expression.

◆ is_integer()

bool drake::symbolic::is_integer ( double  v)

◆ is_isnan() [1/2]

bool drake::symbolic::is_isnan ( const Formula f)

Checks if f is an isnan formula.

◆ is_isnan() [2/2]

bool drake::symbolic::is_isnan ( const FormulaCell f)

Checks if f is an isnan formula.

◆ is_less_than() [1/2]

bool drake::symbolic::is_less_than ( const Formula f)

Checks if f is a formula representing less-than (<).

◆ is_less_than() [2/2]

bool drake::symbolic::is_less_than ( const FormulaCell f)

Checks if f is a formula representing less-than (<).

◆ is_less_than_or_equal_to() [1/2]

bool drake::symbolic::is_less_than_or_equal_to ( const Formula f)

Checks if f is a formula representing less-than-or-equal-to (<=).

◆ is_less_than_or_equal_to() [2/2]

bool drake::symbolic::is_less_than_or_equal_to ( const FormulaCell f)

Checks if f is a formula representing less-than-or-equal-to (<=).

◆ is_log() [1/2]

bool drake::symbolic::is_log ( const Expression e)

Checks if e is a log expression.

◆ is_log() [2/2]

bool drake::symbolic::is_log ( const ExpressionCell c)

Checks if c is a log expression.

◆ is_max() [1/2]

bool drake::symbolic::is_max ( const Expression e)

Checks if e is a max expression.

◆ is_max() [2/2]

bool drake::symbolic::is_max ( const ExpressionCell c)

Checks if c is a max expression.

◆ is_min() [1/2]

bool drake::symbolic::is_min ( const Expression e)

Checks if e is a min expression.

◆ is_min() [2/2]

bool drake::symbolic::is_min ( const ExpressionCell c)

Checks if c is a min expression.

◆ is_multiplication() [1/2]

bool drake::symbolic::is_multiplication ( const Expression e)

Checks if e is a multiplication expression.

◆ is_multiplication() [2/2]

bool drake::symbolic::is_multiplication ( const ExpressionCell c)

Checks if c is an multiplication expression.

◆ is_nan()

bool drake::symbolic::is_nan ( const Expression e)

Checks if e is NaN.

◆ is_nary()

bool drake::symbolic::is_nary ( const Formula f)

Checks if f is a n-ary formula ({∧, ∨}).

◆ is_neg_one()

bool drake::symbolic::is_neg_one ( const Expression e)

Checks if e is -1.0.

◆ is_negation() [1/2]

bool drake::symbolic::is_negation ( const Formula f)

Checks if f is a negation (¬).

◆ is_negation() [2/2]

bool drake::symbolic::is_negation ( const FormulaCell f)

Checks if f is a negation (¬).

◆ is_non_negative_integer()

bool drake::symbolic::is_non_negative_integer ( double  v)

◆ is_not_equal_to() [1/2]

bool drake::symbolic::is_not_equal_to ( const Formula f)

Checks if f is a formula representing disequality (!=).

◆ is_not_equal_to() [2/2]

bool drake::symbolic::is_not_equal_to ( const FormulaCell f)

Checks if f is a formula representing disequality (!=).

◆ is_one()

bool drake::symbolic::is_one ( const Expression e)

Checks if e is 1.0.

◆ is_positive_integer()

bool drake::symbolic::is_positive_integer ( double  v)

◆ is_positive_semidefinite() [1/2]

bool drake::symbolic::is_positive_semidefinite ( const Formula f)

Checks if f is a positive-semidefinite formula.

◆ is_positive_semidefinite() [2/2]

bool drake::symbolic::is_positive_semidefinite ( const FormulaCell f)

Checks if f is a positive semidefinite formula.

◆ is_pow() [1/2]

bool drake::symbolic::is_pow ( const Expression e)

Checks if e is a power-function expression.

◆ is_pow() [2/2]

bool drake::symbolic::is_pow ( const ExpressionCell c)

Checks if c is a power-function expression.

◆ is_relational() [1/2]

bool drake::symbolic::is_relational ( const Formula f)

Checks if f is a relational formula ({==, !=, >, >=, <, <=}).

◆ is_relational() [2/2]

bool drake::symbolic::is_relational ( const FormulaCell f)

Checks if f is a relational formula ({==, !=, >, >=, <, <=}).

◆ is_sin() [1/2]

bool drake::symbolic::is_sin ( const Expression e)

Checks if e is a sine expression.

◆ is_sin() [2/2]

bool drake::symbolic::is_sin ( const ExpressionCell c)

Checks if c is a sine expression.

◆ is_sinh() [1/2]

bool drake::symbolic::is_sinh ( const Expression e)

Checks if e is a hyperbolic-sine expression.

◆ is_sinh() [2/2]

bool drake::symbolic::is_sinh ( const ExpressionCell c)

Checks if c is a hyperbolic-sine expression.

◆ is_sqrt() [1/2]

bool drake::symbolic::is_sqrt ( const Expression e)

Checks if e is a square-root expression.

◆ is_sqrt() [2/2]

bool drake::symbolic::is_sqrt ( const ExpressionCell c)

Checks if c is a square-root expression.

◆ is_tan() [1/2]

bool drake::symbolic::is_tan ( const Expression e)

Checks if e is a tangent expression.

◆ is_tan() [2/2]

bool drake::symbolic::is_tan ( const ExpressionCell c)

Checks if c is a tangent expression.

◆ is_tanh() [1/2]

bool drake::symbolic::is_tanh ( const Expression e)

Checks if e is a hyperbolic-tangent expression.

◆ is_tanh() [2/2]

bool drake::symbolic::is_tanh ( const ExpressionCell c)

Checks if c is a hyperbolic-tangent expression.

◆ is_true() [1/2]

bool drake::symbolic::is_true ( const Formula f)

Checks if f is structurally equal to True formula.

◆ is_true() [2/2]

bool drake::symbolic::is_true ( const FormulaCell f)

Checks if f is structurally equal to True formula.

◆ is_two()

bool drake::symbolic::is_two ( const Expression e)

Checks if e is 2.0.

◆ is_unary()

bool drake::symbolic::is_unary ( const ExpressionCell c)

Checks if c is a unary expression.

◆ is_uninterpreted_function() [1/2]

bool drake::symbolic::is_uninterpreted_function ( const Expression e)

Checks if e is an uninterpreted-function expression.

◆ is_uninterpreted_function() [2/2]

bool drake::symbolic::is_uninterpreted_function ( const ExpressionCell c)

Checks if c is an uninterpreted-function expression.

◆ is_variable() [1/4]

bool drake::symbolic::is_variable ( const Formula f)

Checks if f is a variable formula.

◆ is_variable() [2/4]

bool drake::symbolic::is_variable ( const FormulaCell f)

Checks if f is a variable formula.

◆ is_variable() [3/4]

bool drake::symbolic::is_variable ( const Expression e)

Checks if e is a variable expression.

◆ is_variable() [4/4]

bool drake::symbolic::is_variable ( const ExpressionCell c)

Checks if c is a variable expression.

◆ is_zero()

bool drake::symbolic::is_zero ( const Expression e)

Checks if e is 0.0.

◆ IsAffine() [1/2]

bool drake::symbolic::IsAffine ( const Eigen::Ref< const MatrixX< Expression >> &  m,
const Variables vars 
)

Checks if every element in m is affine in vars.

Note
If m is an empty matrix, it returns true.

◆ IsAffine() [2/2]

bool drake::symbolic::IsAffine ( const Eigen::Ref< const MatrixX< Expression >> &  m)

Checks if every element in m is affine.

Note
If m is an empty matrix, it returns true.

◆ isfinite()

Formula drake::symbolic::isfinite ( const Expression e)

Returns a Formula determining if the given expression e has a finite value.

Exceptions
std::exceptionif NaN is detected during evaluation.

◆ isinf()

Formula drake::symbolic::isinf ( const Expression e)

Returns a Formula determining if the given expression e is a positive or negative infinity.

Exceptions
std::exceptionif NaN is detected during evaluation.

◆ isnan()

Formula drake::symbolic::isnan ( const Expression e)

Returns a Formula for the predicate isnan(e) to the given expression.

This serves as the argument-dependent lookup related to std::isnan(double).

When this formula is evaluated, there are two possible outcomes:

  • Returns false if the e.Evaluate() is not NaN.
  • Throws std::exception if NaN is detected during evaluation. Note that the evaluation of isnan(e) never returns true.

◆ Jacobian() [1/3]

MatrixX<Polynomial> drake::symbolic::Jacobian ( const Eigen::Ref< const VectorX< Polynomial >> &  f,
const Eigen::Ref< const VectorX< Variable >> &  vars 
)

Computes the Jacobian matrix J of the vector function f with respect to vars.

J(i,j) contains ∂f(i)/∂vars(j).

Precondition
vars is non-empty.

◆ Jacobian() [2/3]

MatrixX<Expression> drake::symbolic::Jacobian ( const Eigen::Ref< const VectorX< Expression >> &  f,
const std::vector< Variable > &  vars 
)

Computes the Jacobian matrix J of the vector function f with respect to vars.

J(i,j) contains ∂f(i)/∂vars(j).

For example, Jacobian([x * cos(y), x * sin(y), x^2], {x, y}) returns the following 3x2 matrix:

 = |cos(y)   -x * sin(y)|
   |sin(y)    x * cos(y)|
   | 2 * x             0|
 
Precondition
{vars is non-empty}.

◆ Jacobian() [3/3]

MatrixX<Expression> drake::symbolic::Jacobian ( const Eigen::Ref< const VectorX< Expression >> &  f,
const Eigen::Ref< const VectorX< Variable >> &  vars 
)

Computes the Jacobian matrix J of the vector function f with respect to vars.

J(i,j) contains ∂f(i)/∂vars(j).

Precondition
{vars is non-empty}.

◆ log()

Expression drake::symbolic::log ( const Expression e)

◆ make_conjunction()

Formula drake::symbolic::make_conjunction ( const std::set< Formula > &  formulas)

Returns a conjunction of formulas.

It performs the following simplification:

  • make_conjunction({}) returns True.
  • make_conjunction({f₁}) returns f₁.
  • If False ∈ formulas, it returns False.
  • If True ∈ formulas, it will not appear in the return value.
  • Nested conjunctions will be flattened. For example, make_conjunction({f₁, f₂ ∧ f₃}) returns f₁ ∧ f₂ ∧ f₃.

◆ make_disjunction()

Formula drake::symbolic::make_disjunction ( const std::set< Formula > &  formulas)

Returns a disjunction of formulas.

It performs the following simplification:

  • make_disjunction({}) returns False.
  • make_disjunction({f₁}) returns f₁.
  • If True ∈ formulas, it returns True.
  • If False ∈ formulas, it will not appear in the return value.
  • Nested disjunctions will be flattened. For example, make_disjunction({f₁, f₂ ∨ f₃}) returns f₁ ∨ f₂ ∨ f₃.

◆ MakeMatrixBinaryVariable() [1/2]

MatrixX<Variable> drake::symbolic::MakeMatrixBinaryVariable ( int  rows,
int  cols,
const std::string &  name 
)

Creates a dynamically-sized Eigen matrix of symbolic binary variables.

Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).

◆ MakeMatrixBinaryVariable() [2/2]

Eigen::Matrix<Variable, rows, cols> drake::symbolic::MakeMatrixBinaryVariable ( const std::string &  name)

Creates a static-sized Eigen matrix of symbolic binary variables.

Template Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
Parameters
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).

◆ MakeMatrixBooleanVariable() [1/2]

MatrixX<Variable> drake::symbolic::MakeMatrixBooleanVariable ( int  rows,
int  cols,
const std::string &  name 
)

Creates a dynamically-sized Eigen matrix of symbolic Boolean variables.

Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).

◆ MakeMatrixBooleanVariable() [2/2]

Eigen::Matrix<Variable, rows, cols> drake::symbolic::MakeMatrixBooleanVariable ( const std::string &  name)

Creates a static-sized Eigen matrix of symbolic Boolean variables.

Template Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
Parameters
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).

◆ MakeMatrixContinuousVariable() [1/2]

MatrixX<Variable> drake::symbolic::MakeMatrixContinuousVariable ( int  rows,
int  cols,
const std::string &  name 
)

Creates a dynamically-sized Eigen matrix of symbolic continuous variables.

Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).

◆ MakeMatrixContinuousVariable() [2/2]

Eigen::Matrix<Variable, rows, cols> drake::symbolic::MakeMatrixContinuousVariable ( const std::string &  name)

Creates a static-sized Eigen matrix of symbolic continuous variables.

Template Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
Parameters
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).

◆ MakeMatrixIntegerVariable() [1/2]

MatrixX<Variable> drake::symbolic::MakeMatrixIntegerVariable ( int  rows,
int  cols,
const std::string &  name 
)

Creates a dynamically-sized Eigen matrix of symbolic integer variables.

Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).

◆ MakeMatrixIntegerVariable() [2/2]

Eigen::Matrix<Variable, rows, cols> drake::symbolic::MakeMatrixIntegerVariable ( const std::string &  name)

Creates a static-sized Eigen matrix of symbolic integer variables.

Template Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
Parameters
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).

◆ MakeMatrixVariable() [1/2]

MatrixX<Variable> drake::symbolic::MakeMatrixVariable ( int  rows,
int  cols,
const std::string &  name,
Variable::Type  type = Variable::Type::CONTINUOUS 
)

Creates a dynamically-sized Eigen matrix of symbolic variables.

Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).
typeThe type of variables in the matrix.

◆ MakeMatrixVariable() [2/2]

Eigen::Matrix<Variable, rows, cols> drake::symbolic::MakeMatrixVariable ( const std::string &  name,
Variable::Type  type = Variable::Type::CONTINUOUS 
)

Creates a static-sized Eigen matrix of symbolic variables.

Template Parameters
rowsThe number of rows in the new matrix.
colsThe number of cols in the new matrix.
Parameters
nameThe common prefix for variables. The (i, j)-th element will be named as name(i, j).
typeThe type of variables in the matrix.

◆ MakeRuleRewriter()

Rewriter drake::symbolic::MakeRuleRewriter ( const RewritingRule r)

Constructs a rewriter based on a rewriting rule r.

◆ MakeVectorBinaryVariable() [1/2]

VectorX<Variable> drake::symbolic::MakeVectorBinaryVariable ( int  rows,
const std::string &  name 
)

Creates a dynamically-sized Eigen vector of symbolic binary variables.

Parameters
rowsThe size of vector.
nameThe common prefix for variables. The i-th element will be named as name(i).

◆ MakeVectorBinaryVariable() [2/2]

Eigen::Matrix<Variable, rows, 1> drake::symbolic::MakeVectorBinaryVariable ( const std::string &  name)

Creates a static-sized Eigen vector of symbolic binary variables.

Template Parameters
rowsThe size of vector.
Parameters
nameThe common prefix for variables. The i-th element will be named as name(i).

◆ MakeVectorBooleanVariable() [1/2]

VectorX<Variable> drake::symbolic::MakeVectorBooleanVariable ( int  rows,
const std::string &  name 
)

Creates a dynamically-sized Eigen vector of symbolic Boolean variables.

Parameters
rowsThe size of vector.
nameThe common prefix for variables. The i-th element will be named as name(i).

◆ MakeVectorBooleanVariable() [2/2]

Eigen::Matrix<Variable, rows, 1> drake::symbolic::MakeVectorBooleanVariable ( const std::string &  name)

Creates a static-sized Eigen vector of symbolic Boolean variables.

Template Parameters
rowsThe size of vector.
Parameters
nameThe common prefix for variables. The i-th element will be named as name(i).

◆ MakeVectorContinuousVariable() [1/2]

VectorX<Variable> drake::symbolic::MakeVectorContinuousVariable ( int  rows,
const std::string &  name 
)

Creates a dynamically-sized Eigen vector of symbolic continuous variables.

Parameters
rowsThe size of vector.
nameThe common prefix for variables. The i-th element will be named as name(i).

◆ MakeVectorContinuousVariable() [2/2]

Eigen::Matrix<Variable, rows, 1> drake::symbolic::MakeVectorContinuousVariable ( const std::string &  name)

Creates a static-sized Eigen vector of symbolic continuous variables.

Template Parameters
rowsThe size of vector.
Parameters
nameThe common prefix for variables. The i-th element will be named as name(i).

◆ MakeVectorIntegerVariable() [1/2]

VectorX<Variable> drake::symbolic::MakeVectorIntegerVariable ( int  rows,
const std::string &  name 
)

Creates a dynamically-sized Eigen vector of symbolic integer variables.

Parameters
rowsThe size of vector.
nameThe common prefix for variables. The i-th element will be named as name(i).

◆ MakeVectorIntegerVariable() [2/2]

Eigen::Matrix<Variable, rows, 1> drake::symbolic::MakeVectorIntegerVariable ( const std::string &  name)

Creates a static-sized Eigen vector of symbolic integer variables.

Template Parameters
rowsThe size of vector.
Parameters
nameThe common prefix for variables. The i-th element will be named as name(i).

◆ MakeVectorVariable() [1/2]

VectorX<Variable> drake::symbolic::MakeVectorVariable ( int  rows,
const std::string &  name,
Variable::Type  type = Variable::Type::CONTINUOUS 
)

Creates a dynamically-sized Eigen vector of symbolic variables.

Parameters
rowsThe size of vector.
nameThe common prefix for variables. The i-th element will be named as name(i).
typeThe type of variables in the vector.

◆ MakeVectorVariable() [2/2]

Eigen::Matrix<Variable, rows, 1> drake::symbolic::MakeVectorVariable ( const std::string &  name,
Variable::Type  type = Variable::Type::CONTINUOUS 
)

Creates a static-sized Eigen vector of symbolic variables.

Template Parameters
rowsThe size of vector.
Parameters
nameThe common prefix for variables. The i-th element will be named as name(i).
typeThe type of variables in the vector.

◆ max()

Expression drake::symbolic::max ( const Expression e1,
const Expression e2 
)

◆ min()

Expression drake::symbolic::min ( const Expression e1,
const Expression e2 
)

◆ MonomialBasis() [1/3]

Eigen::Matrix<Monomial, Eigen::Dynamic, 1> drake::symbolic::MonomialBasis ( const Variables vars,
int  degree 
)

Returns all monomials up to a given degree under the graded reverse lexicographic order.

Note that graded reverse lexicographic order uses the total order among Variable which is based on a variable's unique ID. For example, for a given variable ordering x > y > z, MonomialBasis({x, y, z}, 2) returns a column vector [x^2, xy, y^2, xz, yz, z^2, x, y, z, 1].

Precondition
vars is a non-empty set.
degree is a non-negative integer.

◆ MonomialBasis() [2/3]

Eigen::Matrix<Monomial, NChooseK(n + degree, degree), 1> drake::symbolic::MonomialBasis ( const Variables vars)

Returns all monomials up to a given degree under the graded reverse lexicographic order.

Template Parameters
nnumber of variables.
degreemaximum total degree of monomials to compute.
Precondition
vars is a non-empty set.
vars.size() == n.

◆ MonomialBasis() [3/3]

VectorX<Monomial> drake::symbolic::MonomialBasis ( const std::unordered_map< Variables, int > &  variables_degree)

Returns all the monomials (in graded reverse lexicographic order) such that the total degree for each set of variables is no larger than a specific degree.

For example if x_set = {x₀, x₁} and y_set = {y₀, y₁}, then MonomialBasis({{x_set, 2}, {y_set, 1}}) will include all the monomials, whose total degree of x_set is no larger than 2, and the total degree of y_set is no larger than 1. Hence it can include monomials such as x₀x₁y₀, but not x₀y₀y₁ because the total degree for y_set is 2. So it would return the following set of monomials (ignoring the ordering) {x₀²y₀, x₀²y₁, x₀x₁y₀, x₀x₁y₁, x₁²y₀, x₁²y₀, x₀y₀, x₀y₁, x₁y₀, x₁y₁, x₀², x₀x₁, x₁², x₀, x₁, y₀, y₁, 1}.

Parameters
variables_degree(vars, degree) maps each set of variables vars to the maximal degree of these variables in the monomial. Namely the summation of the degree of each variable in vars is no larger than degree.
Precondition
The variables in variables_degree don't overlap.
The degree in variables_degree are non-negative.

◆ NChooseK()

constexpr int drake::symbolic::NChooseK ( int  n,
int  k 
)

◆ OddDegreeMonomialBasis()

Eigen::Matrix<Monomial, Eigen::Dynamic, 1> drake::symbolic::OddDegreeMonomialBasis ( const Variables vars,
int  degree 
)

Returns all odd degree monomials up to a given degree under the graded reverse lexicographic order.

A monomial has an odd degree if its total degree is odd. So x²y is an odd degree monomial (degree 3) while xy is not (degree 2). Note that graded reverse lexicographic order uses the total order among Variable which is based on a variable's unique ID. For example, for a given variable ordering x > y > z, OddDegreeMonomialBasis({x, y, z}, 3) returns a column vector [x³, x²y, xy², y³, x²z, xyz, y²z, xz², yz², z³, x, y, z]

Precondition
vars is a non-empty set.
degree is a non-negative integer.

◆ operator &&() [1/4]

Formula drake::symbolic::operator && ( const Formula f1,
const Formula f2 
)

◆ operator &&() [2/4]

Formula drake::symbolic::operator && ( const Variable v,
const Formula f 
)

◆ operator &&() [3/4]

Formula drake::symbolic::operator && ( const Formula f,
const Variable v 
)

◆ operator &&() [4/4]

Formula drake::symbolic::operator && ( const Variable v1,
const Variable v2 
)

◆ operator *() [1/43]

std::map<ChebyshevBasisElement, double> drake::symbolic::operator * ( const ChebyshevBasisElement a,
const ChebyshevBasisElement b 
)

Returns the product of two Chebyshev basis elements.

Since Tₘ(x) * Tₙ(x) = 0.5 (Tₘ₊ₙ(x) + Tₘ₋ₙ(x)) if m >= n, the product of Chebyshev basis elements is the weighted sum of several Chebyshev basis elements. For example T₁(x)T₂(y) * T₃(x)T₁(y) = 0.25*(T₄(x)T₃(y) + T₂(x)T₃(y)

  • T₄(x)T₁(y) + T₂(x)T₁(y))
    Returns
    the result of the product, from each ChebyshevBasisElement to its coefficient. In the example above, it returns (T₄(x)T₃(y) -> 0.25), (T₂(x)T₃(y) -> 0.25), (T₄(x)T₁(y) -> 0.25) and (T₂(x)T₁(y) -> 0.25)

◆ operator *() [2/43]

Monomial drake::symbolic::operator * ( Monomial  m1,
const Monomial m2 
)

Returns a multiplication of two monomials, m1 and m2.

◆ operator *() [3/43]

RationalFunction drake::symbolic::operator * ( RationalFunction  f1,
const RationalFunction f2 
)

◆ operator *() [4/43]

RationalFunction drake::symbolic::operator * ( RationalFunction  f,
const Polynomial p 
)

◆ operator *() [5/43]

RationalFunction drake::symbolic::operator * ( const Polynomial p,
RationalFunction  f 
)

◆ operator *() [6/43]

RationalFunction drake::symbolic::operator * ( RationalFunction  f,
double  c 
)

◆ operator *() [7/43]

RationalFunction drake::symbolic::operator * ( double  c,
RationalFunction  f 
)

◆ operator *() [8/43]

RationalFunction drake::symbolic::operator * ( const Monomial m,
RationalFunction  f 
)

◆ operator *() [9/43]

RationalFunction drake::symbolic::operator * ( RationalFunction  f,
const Monomial m 
)

◆ operator *() [10/43]

std::map<MonomialBasisElement, double> drake::symbolic::operator * ( const MonomialBasisElement m1,
const MonomialBasisElement m2 
)

Returns a multiplication of two monomials, m1 and m2.

Note
that we return a map from the monomial product to its coefficient. This map has size 1, and the coefficient is also 1. We return a map instead of the MonomialBasisElement directly, because we want operator* to have the same return signature as other PolynomialBasisElement. For example, the product between two ChebyshevBasisElement objects is a weighted sum of ChebyshevBasisElement objects.
we do not provide operator*= function for this class, since operator*= would return MonomialBasisElement, which is different from operator*.

◆ operator *() [11/43]

Eigen::Matrix<RationalFunction, MatrixL::RowsAtCompileTime, MatrixR::ColsAtCompileTime> drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following operations:

  • Matrix<RF> * Matrix<Polynomial> => Matrix<RF>
  • Matrix<RF> * Matrix<double> => Matrix<RF>
  • Matrix<Polynomial> * Matrix<RF> => Matrix<RF>
  • Matrix<double> * Matrix<RF> => Matrix<RF>

where RF is a shorthand for RationalFunction.

Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [12/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( GenericPolynomial< BasisElement >  p1,
const GenericPolynomial< BasisElement > &  p2 
)

◆ operator *() [13/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( GenericPolynomial< BasisElement >  p,
const BasisElement &  m 
)

◆ operator *() [14/43]

Polynomial drake::symbolic::operator * ( Polynomial  p1,
const Polynomial p2 
)

◆ operator *() [15/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( GenericPolynomial< BasisElement >  p,
double  c 
)

◆ operator *() [16/43]

Polynomial drake::symbolic::operator * ( Polynomial  p,
const Monomial m 
)

◆ operator *() [17/43]

Polynomial drake::symbolic::operator * ( Polynomial  p,
double  c 
)

◆ operator *() [18/43]

Polynomial drake::symbolic::operator * ( const Monomial m,
Polynomial  p 
)

◆ operator *() [19/43]

Polynomial drake::symbolic::operator * ( const Monomial m,
double  c 
)

◆ operator *() [20/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( const BasisElement &  m,
GenericPolynomial< BasisElement >  p 
)

◆ operator *() [21/43]

Polynomial drake::symbolic::operator * ( double  c,
Polynomial  p 
)

◆ operator *() [22/43]

Polynomial drake::symbolic::operator * ( double  c,
const Monomial m 
)

◆ operator *() [23/43]

Polynomial drake::symbolic::operator * ( Polynomial  p,
const Variable v 
)

◆ operator *() [24/43]

Polynomial drake::symbolic::operator * ( const Variable v,
Polynomial  p 
)

◆ operator *() [25/43]

Expression drake::symbolic::operator * ( const Expression e,
const Polynomial p 
)

◆ operator *() [26/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( const BasisElement &  m,
double  c 
)

◆ operator *() [27/43]

Expression drake::symbolic::operator * ( const Polynomial p,
const Expression e 
)

◆ operator *() [28/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( double  c,
GenericPolynomial< BasisElement >  p 
)

◆ operator *() [29/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( double  c,
const BasisElement &  m 
)

◆ operator *() [30/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( GenericPolynomial< BasisElement >  p,
const Variable v 
)

◆ operator *() [31/43]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator * ( const Variable v,
GenericPolynomial< BasisElement >  p 
)

◆ operator *() [32/43]

Eigen::Matrix< Polynomial, MatrixL::RowsAtCompileTime, MatrixR::ColsAtCompileTime > operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [33/43]

Expression drake::symbolic::operator * ( Expression  lhs,
const Expression rhs 
)

◆ operator *() [34/43]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<MatrixL>, MatrixL> && std::is_base_of_v<Eigen::MatrixBase<MatrixR>, MatrixR> && std::is_same_v<typename MatrixL::Scalar, Expression> && std::is_same_v<typename MatrixR::Scalar, double>, internal::ExpressionMatMulResult<MatrixL, MatrixR> > drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [35/43]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<MatrixL>, MatrixL> && std::is_base_of_v<Eigen::MatrixBase<MatrixR>, MatrixR> && std::is_same_v<typename MatrixL::Scalar, double> && std::is_same_v<typename MatrixR::Scalar, Expression>, internal::ExpressionMatMulResult<MatrixL, MatrixR> > drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [36/43]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<MatrixL>, MatrixL> && std::is_base_of_v<Eigen::MatrixBase<MatrixR>, MatrixR> && std::is_same_v<typename MatrixL::Scalar, Expression> && std::is_same_v<typename MatrixR::Scalar, Variable>, internal::ExpressionMatMulResult<MatrixL, MatrixR> > drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [37/43]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<MatrixL>, MatrixL> && std::is_base_of_v<Eigen::MatrixBase<MatrixR>, MatrixR> && std::is_same_v<typename MatrixL::Scalar, Variable> && std::is_same_v<typename MatrixR::Scalar, Expression>, internal::ExpressionMatMulResult<MatrixL, MatrixR> > drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [38/43]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<MatrixL>, MatrixL> && std::is_base_of_v<Eigen::MatrixBase<MatrixR>, MatrixR> && std::is_same_v<typename MatrixL::Scalar, Variable> && std::is_same_v<typename MatrixR::Scalar, double>, internal::ExpressionMatMulResult<MatrixL, MatrixR> > drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [39/43]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<MatrixL>, MatrixL> && std::is_base_of_v<Eigen::MatrixBase<MatrixR>, MatrixR> && std::is_same_v<typename MatrixL::Scalar, double> && std::is_same_v<typename MatrixR::Scalar, Variable>, internal::ExpressionMatMulResult<MatrixL, MatrixR> > drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [40/43]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<MatrixL>, MatrixL> && std::is_base_of_v<Eigen::MatrixBase<MatrixR>, MatrixR> && std::is_same_v<typename MatrixL::Scalar, Variable> && std::is_same_v<typename MatrixR::Scalar, Variable>, internal::ExpressionMatMulResult<MatrixL, MatrixR> > drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [41/43]

std::enable_if_t< std::is_base_of_v<Eigen::MatrixBase<MatrixL>, MatrixL> && std::is_base_of_v<Eigen::MatrixBase<MatrixR>, MatrixR> && std::is_same_v<typename MatrixL::Scalar, Expression> && std::is_same_v<typename MatrixR::Scalar, Expression>, internal::ExpressionMatMulResult<MatrixL, MatrixR> > drake::symbolic::operator * ( const MatrixL &  lhs,
const MatrixR &  rhs 
)

Provides the following matrix operations:

Provides the following operations:

  • Matrix<Polynomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Polynomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<Variable> => Matrix<Polynomial>
  • Matrix<Monomial> * Matrix<double> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<Variable> * Matrix<Monomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Polynomial> => Matrix<Polynomial>
  • Matrix<double> * Matrix<Monomial> => Matrix<Polynomial>
Note
that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.
  • Matrix<Expression> * Matrix<Polynomial> => Matrix<Expression>
  • Matrix<Expression> * Matrix<Monomial> => Matrix<Expression>
  • Matrix<Polynomial> * Matrix<Expression> => Matrix<Expression>
  • Matrix<Monomial> * Matrix<Expression> => Matrix<Expression>
    Note
    that these operator overloadings are necessary even after providing Eigen::ScalarBinaryOpTraits. See https://stackoverflow.com/questions/41494288/mixing-scalar-types-in-eigen for more information.

◆ operator *() [42/43]

auto drake::symbolic::operator * ( const Eigen::Transform< Expression, Dim, LhsMode, LhsOptions > &  t1,
const Eigen::Transform< double, Dim, RhsMode, RhsOptions > &  t2 
)

Transform<double> * Transform<Expression> => Transform<Expression>

◆ operator *() [43/43]

auto drake::symbolic::operator * ( const Eigen::Transform< double, Dim, LhsMode, LhsOptions > &  t1,
const Eigen::Transform< Expression, Dim, RhsMode, RhsOptions > &  t2 
)

Transform<Expression> * Transform<double> => Transform<Expression>

◆ operator *=()

Expression& drake::symbolic::operator *= ( Expression lhs,
const Expression rhs 
)

◆ operator!() [1/2]

Formula drake::symbolic::operator! ( const Formula f)

◆ operator!() [2/2]

Formula drake::symbolic::operator! ( const Variable v)

◆ operator!=() [1/5]

Formula drake::symbolic::operator!= ( const Expression e1,
const Expression e2 
)

◆ operator!=() [2/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::ArrayXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() != typename DerivedB::Scalar()), Formula>, typename internal::RelationalOpTraits<DerivedA, DerivedB>::ReturnType> drake::symbolic::operator!= ( const DerivedA &  a1,
const DerivedB &  a2 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using not-equal operator (!=).

◆ operator!=() [3/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename Derived::Scalar() != ScalarType()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator!= ( const Derived &  a,
const ScalarType &  v 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using not-equal operator (!=).

That is, for all i and j, the (i, j)-th entry of (a != v) has a symbolic formula a(i, j) != v.

◆ operator!=() [4/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(ScalarType() != typename Derived::Scalar()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator!= ( const ScalarType &  v,
const Derived &  a 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using not-equal operator (!=).

That is, for all i and j, the (i, j)-th entry of (v != a) has a symbolic formula v != a(i, j).

◆ operator!=() [5/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::MatrixXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::MatrixXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() != typename DerivedB::Scalar()), Formula>, Formula> drake::symbolic::operator!= ( const DerivedA &  m1,
const DerivedB &  m2 
)

Returns a symbolic formula representing the condition whether m1 and m2 are not the same.

The following table describes the return type of m1 != m2.

LHS \ RHS EM<Expression> EM<Variable> EM<double>
EM<Expression> Formula Formula Formula
EM<Variable> Formula Formula Formula
EM<double> Formula Formula bool

In the table, EM is a short-hand of Eigen::Matrix.

Note that this function does not provide operator overloading for the following case. It returns bool and is provided by Eigen.

  • Eigen::Matrix<double> != Eigen::Matrix<double>

◆ operator+() [1/35]

RationalFunction drake::symbolic::operator+ ( RationalFunction  f1,
const RationalFunction f2 
)

◆ operator+() [2/35]

Variables drake::symbolic::operator+ ( Variables  vars1,
const Variables vars2 
)

Returns set-union of var1 and var2.

◆ operator+() [3/35]

RationalFunction drake::symbolic::operator+ ( RationalFunction  f,
const Polynomial p 
)

◆ operator+() [4/35]

RationalFunction drake::symbolic::operator+ ( const Polynomial p,
RationalFunction  f 
)

◆ operator+() [5/35]

Variables drake::symbolic::operator+ ( Variables  vars,
const Variable var 
)

Returns set-union of vars and {var}.

◆ operator+() [6/35]

RationalFunction drake::symbolic::operator+ ( const Monomial m,
RationalFunction  f 
)

◆ operator+() [7/35]

RationalFunction drake::symbolic::operator+ ( RationalFunction  f,
const Monomial m 
)

◆ operator+() [8/35]

Variables drake::symbolic::operator+ ( const Variable var,
Variables  vars 
)

Returns set-union of {var} and vars.

◆ operator+() [9/35]

RationalFunction drake::symbolic::operator+ ( RationalFunction  f,
double  c 
)

◆ operator+() [10/35]

RationalFunction drake::symbolic::operator+ ( double  c,
RationalFunction  f 
)

◆ operator+() [11/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( GenericPolynomial< BasisElement >  p1,
const GenericPolynomial< BasisElement > &  p2 
)

◆ operator+() [12/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( GenericPolynomial< BasisElement >  p,
const BasisElement &  m 
)

◆ operator+() [13/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( GenericPolynomial< BasisElement >  p,
double  c 
)

◆ operator+() [14/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( const BasisElement &  m,
GenericPolynomial< BasisElement >  p 
)

◆ operator+() [15/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( const BasisElement &  m1,
const BasisElement &  m2 
)

◆ operator+() [16/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( const BasisElement &  m,
double  c 
)

◆ operator+() [17/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( double  c,
GenericPolynomial< BasisElement >  p 
)

◆ operator+() [18/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( double  c,
const BasisElement &  m 
)

◆ operator+() [19/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( GenericPolynomial< BasisElement >  p,
const Variable v 
)

◆ operator+() [20/35]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator+ ( const Variable v,
GenericPolynomial< BasisElement >  p 
)

◆ operator+() [21/35]

Polynomial drake::symbolic::operator+ ( Polynomial  p1,
const Polynomial p2 
)

◆ operator+() [22/35]

Polynomial drake::symbolic::operator+ ( Polynomial  p,
const Monomial m 
)

◆ operator+() [23/35]

Polynomial drake::symbolic::operator+ ( Polynomial  p,
double  c 
)

◆ operator+() [24/35]

Polynomial drake::symbolic::operator+ ( const Monomial m,
Polynomial  p 
)

◆ operator+() [25/35]

Polynomial drake::symbolic::operator+ ( const Monomial m1,
const Monomial m2 
)

◆ operator+() [26/35]

Polynomial drake::symbolic::operator+ ( const Monomial m,
double  c 
)

◆ operator+() [27/35]

Polynomial drake::symbolic::operator+ ( double  c,
Polynomial  p 
)

◆ operator+() [28/35]

Polynomial drake::symbolic::operator+ ( double  c,
const Monomial m 
)

◆ operator+() [29/35]

Polynomial drake::symbolic::operator+ ( Polynomial  p,
const Variable v 
)

◆ operator+() [30/35]

Polynomial drake::symbolic::operator+ ( const Variable v,
Polynomial  p 
)

◆ operator+() [31/35]

Expression drake::symbolic::operator+ ( const Expression e,
const Polynomial p 
)

◆ operator+() [32/35]

Expression drake::symbolic::operator+ ( const Polynomial p,
const Expression e 
)

◆ operator+() [33/35]

Expression drake::symbolic::operator+ ( Expression  lhs,
const Expression rhs 
)

◆ operator+() [34/35]

Expression drake::symbolic::operator+ ( const Expression e)

◆ operator+() [35/35]

Expression drake::symbolic::operator+ ( const Variable var)

◆ operator+=() [1/3]

Variables& drake::symbolic::operator+= ( Variables vars1,
const Variables vars2 
)

Updates var1 with the result of set-union(var1, var2).

◆ operator+=() [2/3]

Variables& drake::symbolic::operator+= ( Variables vars,
const Variable var 
)

Updates vars with the result of set-union(vars, { var }).

◆ operator+=() [3/3]

Expression& drake::symbolic::operator+= ( Expression lhs,
const Expression rhs 
)

◆ operator-() [1/36]

RationalFunction drake::symbolic::operator- ( RationalFunction  f1,
const RationalFunction f2 
)

◆ operator-() [2/36]

RationalFunction drake::symbolic::operator- ( RationalFunction  f,
const Polynomial p 
)

◆ operator-() [3/36]

RationalFunction drake::symbolic::operator- ( const Polynomial p,
const RationalFunction f 
)

◆ operator-() [4/36]

RationalFunction drake::symbolic::operator- ( RationalFunction  f,
double  c 
)

◆ operator-() [5/36]

RationalFunction drake::symbolic::operator- ( double  c,
RationalFunction  f 
)

◆ operator-() [6/36]

RationalFunction drake::symbolic::operator- ( const Monomial m,
RationalFunction  f 
)

◆ operator-() [7/36]

Variables drake::symbolic::operator- ( Variables  vars1,
const Variables vars2 
)

Returns set-minus(var1, vars2).

◆ operator-() [8/36]

RationalFunction drake::symbolic::operator- ( RationalFunction  f,
const Monomial m 
)

◆ operator-() [9/36]

Variables drake::symbolic::operator- ( Variables  vars,
const Variable var 
)

Returns set-minus(vars, { var }).

◆ operator-() [10/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( const GenericPolynomial< BasisElement > &  p)

◆ operator-() [11/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( GenericPolynomial< BasisElement >  p1,
const GenericPolynomial< BasisElement > &  p2 
)

◆ operator-() [12/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( GenericPolynomial< BasisElement >  p,
const BasisElement &  m 
)

◆ operator-() [13/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( GenericPolynomial< BasisElement >  p,
double  c 
)

◆ operator-() [14/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( const BasisElement &  m,
GenericPolynomial< BasisElement >  p 
)

◆ operator-() [15/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( const BasisElement &  m1,
const BasisElement &  m2 
)

◆ operator-() [16/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( const BasisElement &  m,
double  c 
)

◆ operator-() [17/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( double  c,
GenericPolynomial< BasisElement >  p 
)

◆ operator-() [18/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( double  c,
const BasisElement &  m 
)

◆ operator-() [19/36]

Polynomial drake::symbolic::operator- ( const Polynomial p)

Unary minus operation for polynomial.

◆ operator-() [20/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( GenericPolynomial< BasisElement >  p,
const Variable v 
)

◆ operator-() [21/36]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator- ( const Variable v,
GenericPolynomial< BasisElement >  p 
)

◆ operator-() [22/36]

Polynomial drake::symbolic::operator- ( Polynomial  p1,
const Polynomial p2 
)

◆ operator-() [23/36]

Polynomial drake::symbolic::operator- ( Polynomial  p,
const Monomial m 
)

◆ operator-() [24/36]

Polynomial drake::symbolic::operator- ( Polynomial  p,
double  c 
)

◆ operator-() [25/36]

Polynomial drake::symbolic::operator- ( const Monomial m,
Polynomial  p 
)

◆ operator-() [26/36]

Polynomial drake::symbolic::operator- ( const Monomial m1,
const Monomial m2 
)

◆ operator-() [27/36]

Polynomial drake::symbolic::operator- ( const Monomial m,
double  c 
)

◆ operator-() [28/36]

Polynomial drake::symbolic::operator- ( double  c,
Polynomial  p 
)

◆ operator-() [29/36]

Polynomial drake::symbolic::operator- ( double  c,
const Monomial m 
)

◆ operator-() [30/36]

Polynomial drake::symbolic::operator- ( Polynomial  p,
const Variable v 
)

◆ operator-() [31/36]

Polynomial drake::symbolic::operator- ( const Variable v,
const Polynomial p 
)

◆ operator-() [32/36]

Expression drake::symbolic::operator- ( const Expression e,
const Polynomial p 
)

◆ operator-() [33/36]

Expression drake::symbolic::operator- ( const Polynomial p,
const Expression e 
)

◆ operator-() [34/36]

Expression drake::symbolic::operator- ( Expression  lhs,
const Expression rhs 
)

◆ operator-() [35/36]

Expression drake::symbolic::operator- ( const Expression e)

◆ operator-() [36/36]

Expression drake::symbolic::operator- ( const Variable var)

◆ operator-=() [1/3]

Variables& drake::symbolic::operator-= ( Variables vars1,
const Variables vars2 
)

Updates var1 with the result of set-minus(var1, var2).

◆ operator-=() [2/3]

Variables& drake::symbolic::operator-= ( Variables vars,
const Variable var 
)

Updates vars with the result of set-minus(vars, {var}).

◆ operator-=() [3/3]

Expression& drake::symbolic::operator-= ( Expression lhs,
const Expression rhs 
)

◆ operator/() [1/13]

RationalFunction drake::symbolic::operator/ ( RationalFunction  f1,
const RationalFunction f2 
)
Exceptions
std::exceptionif the numerator of the divisor is structurally equal to zero. Note that this does not guarantee that the denominator of the result is not zero after expansion.

◆ operator/() [2/13]

RationalFunction drake::symbolic::operator/ ( RationalFunction  f,
const Polynomial p 
)
Exceptions
std::exceptionif the divisor is structurally equal to zero. Note that this does not guarantee that the denominator of the result is not zero after expansion.

◆ operator/() [3/13]

RationalFunction drake::symbolic::operator/ ( const Polynomial p,
const RationalFunction f 
)
Exceptions
std::exceptionif the numerator of the divisor is structurally equal to zero. Note that this does not guarantee that the denominator of the result is not zero after expansion.

◆ operator/() [4/13]

RationalFunction drake::symbolic::operator/ ( RationalFunction  f,
double  c 
)
Exceptions
std::exceptionif c is 0

◆ operator/() [5/13]

RationalFunction drake::symbolic::operator/ ( double  c,
const RationalFunction f 
)
Exceptions
std::exceptionif the numerator of the divisor is structurally equal to zero. Note that this does not guarantee that the denominator of the result is not zero after expansion.

◆ operator/() [6/13]

RationalFunction drake::symbolic::operator/ ( const Monomial m,
RationalFunction  f 
)

◆ operator/() [7/13]

RationalFunction drake::symbolic::operator/ ( RationalFunction  f,
const Monomial m 
)

◆ operator/() [8/13]

Polynomial drake::symbolic::operator/ ( Polynomial  p,
double  v 
)

Returns p / v.

◆ operator/() [9/13]

Expression drake::symbolic::operator/ ( double  v,
const Polynomial p 
)

◆ operator/() [10/13]

Expression drake::symbolic::operator/ ( const Expression e,
const Polynomial p 
)

◆ operator/() [11/13]

Expression drake::symbolic::operator/ ( const Polynomial p,
const Expression e 
)

◆ operator/() [12/13]

GenericPolynomialEnable<BasisElement> drake::symbolic::operator/ ( GenericPolynomial< BasisElement >  p,
double  v 
)

Returns p / v.

◆ operator/() [13/13]

Expression drake::symbolic::operator/ ( Expression  lhs,
const Expression rhs 
)

◆ operator/=()

Expression& drake::symbolic::operator/= ( Expression lhs,
const Expression rhs 
)

◆ operator<() [1/7]

bool drake::symbolic::operator< ( FormulaKind  k1,
FormulaKind  k2 
)

◆ operator<() [2/7]

bool drake::symbolic::operator< ( ExpressionKind  k1,
ExpressionKind  k2 
)

Total ordering between ExpressionKinds.

◆ operator<() [3/7]

Formula drake::symbolic::operator< ( const Expression e1,
const Expression e2 
)

◆ operator<() [4/7]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::ArrayXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() < typename DerivedB::Scalar()), Formula>, typename internal::RelationalOpTraits<DerivedA, DerivedB>::ReturnType> drake::symbolic::operator< ( const DerivedA &  a1,
const DerivedB &  a2 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using less-than operator (<).

◆ operator<() [5/7]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(ScalarType() < typename Derived::Scalar()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator< ( const ScalarType &  v,
const Derived &  a 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using less-than operator (<).

That is, for all i and j, the (i, j)-th entry of (v < a) has a symbolic formula v < a(i, j).

◆ operator<() [6/7]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename Derived::Scalar() < ScalarType()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator< ( const Derived &  a,
const ScalarType &  v 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using less-than operator (<).

That is, for all i and j, the (i, j)-th entry of (a < v) has a symbolic formula a(i, j) < v.

◆ operator<() [7/7]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::MatrixXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::MatrixXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() < typename DerivedB::Scalar()), Formula>, Formula> drake::symbolic::operator< ( const DerivedA &  m1,
const DerivedB &  m2 
)

Returns a symbolic formula representing element-wise comparison between two matrices m1 and m2 using less-than (<) operator.

The following table describes the return type of m1 < m2.

LHS \ RHS EM<Expression> EM<Variable> EM<double>
EM<Expression> Formula Formula Formula
EM<Variable> Formula Formula Formula
EM<double> Formula Formula N/A

In the table, EM is a short-hand of Eigen::Matrix.

◆ operator<<() [1/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  os,
Variable::Type  type 
)

◆ operator<<() [2/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  out,
const ChebyshevPolynomial p 
)

◆ operator<<() [3/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  out,
const ChebyshevBasisElement m 
)

◆ operator<<() [4/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  out,
const Monomial m 
)

◆ operator<<() [5/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  out,
const MonomialBasisElement m 
)

◆ operator<<() [6/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  os,
const Formula f 
)

◆ operator<<() [7/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  os,
const Polynomial p 
)

◆ operator<<() [8/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  os,
const GenericPolynomial< BasisElement > &  p 
)

◆ operator<<() [9/9]

std::ostream& drake::symbolic::operator<< ( std::ostream &  os,
const Expression e 
)

◆ operator<=() [1/5]

Formula drake::symbolic::operator<= ( const Expression e1,
const Expression e2 
)

◆ operator<=() [2/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(ScalarType() <= typename Derived::Scalar()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator<= ( const ScalarType &  v,
const Derived &  a 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using less-than-or-equal operator (<=).

That is, for all i and j, the (i, j)-th entry of (v <= a) has a symbolic formula v <= a(i, j).

◆ operator<=() [3/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::ArrayXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() <= typename DerivedB::Scalar()), Formula>, typename internal::RelationalOpTraits<DerivedA, DerivedB>::ReturnType> drake::symbolic::operator<= ( const DerivedA &  a1,
const DerivedB &  a2 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using less-than-or-equal operator (<=).

◆ operator<=() [4/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename Derived::Scalar() <= ScalarType()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator<= ( const Derived &  a,
const ScalarType &  v 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using less-than-or-equal operator (<=).

That is, for all i and j, the (i, j)-th entry of (a <= v) has a symbolic formula a(i, j) <= v.

◆ operator<=() [5/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::MatrixXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::MatrixXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() <= typename DerivedB::Scalar()), Formula>, Formula> drake::symbolic::operator<= ( const DerivedA &  m1,
const DerivedB &  m2 
)

Returns a symbolic formula representing element-wise comparison between two matrices m1 and m2 using less-than-or-equal operator (<=).

The following table describes the return type of m1 <= m2.

LHS \ RHS EM<Expression> EM<Variable> EM<double>
EM<Expression> Formula Formula Formula
EM<Variable> Formula Formula Formula
EM<double> Formula Formula N/A

In the table, EM is a short-hand of Eigen::Matrix.

◆ operator==() [1/5]

Formula drake::symbolic::operator== ( const Expression e1,
const Expression e2 
)

◆ operator==() [2/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::ArrayXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() == typename DerivedB::Scalar()), Formula>, typename internal::RelationalOpTraits<DerivedA, DerivedB>::ReturnType> drake::symbolic::operator== ( const DerivedA &  a1,
const DerivedB &  a2 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise symbolic-equality of two arrays m1 and m2.

The following table describes the return type of m1 == m2.

LHS \ RHS EA<Expression> EA<Variable> EA<double>
EA<Expression> EA<Formula> EA<Formula> EA<Formula>
EA<Variable> EA<Formula> EA<Formula> EA<Formula>
EA<double> EA<Formula> EA<Formula> EA<bool>

In the table, EA is a short-hand of Eigen::Array.

Note that this function does not provide operator overloading for the following case. It returns Eigen::Array<bool> and is provided by Eigen.

  • Eigen::Array<double> == Eigen::Array<double>

◆ operator==() [3/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename Derived::Scalar() == ScalarType()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator== ( const Derived &  a,
const ScalarType &  v 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using equal-to operator (==).

That is, for all i and j, the (i, j)-th entry of (a == v) has a symbolic formula a(i, j) == v.

Here is an example using this operator overloading.

Eigen::Array<Variable, 2, 2> a;
a << Variable{"x"}, Variable{"y"},
Variable{"z"}, Variable{"w"};
Eigen::Array<Formula, 2, 2> f = (a == 3.5);
// Here f = |(x == 3.5) (y == 3.5)|
// |(z == 3.5) (w == 3.5)|.

◆ operator==() [4/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(ScalarType() == typename Derived::Scalar()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator== ( const ScalarType &  v,
const Derived &  a 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using equal-to operator (==).

That is, for all i and j, the (i, j)-th entry of (v == a) has a symbolic formula v == a(i, j).

Here is an example using this operator overloading.

Eigen::Array<Variable, 2, 2> a;
a << Variable{"x"}, Variable{"y"},
Variable{"z"}, Variable{"w"};
Eigen::Array<Formula, 2, 2> f = (3.5 == a);
// Here f = |(3.5 == x) (3.5 == y)|
// |(3.5 == z) (3.5 == w)|.

◆ operator==() [5/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::MatrixXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::MatrixXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() == typename DerivedB::Scalar()), Formula>, Formula> drake::symbolic::operator== ( const DerivedA &  m1,
const DerivedB &  m2 
)

Returns a symbolic formula checking if two matrices m1 and m2 are equal.

The following table describes the return type of m1 == m2.

LHS \ RHS EM<Expression> EM<Variable> EM<double>
EM<Expression> Formula Formula Formula
EM<Variable> Formula Formula Formula
EM<double> Formula Formula bool

In the table, EM is a short-hand of Eigen::Matrix.

Note that this function does not provide operator overloading for the following case. It returns bool and is provided by Eigen.

  • Eigen::Matrix<double> == Eigen::Matrix<double>

Note that this method returns a conjunctive formula which keeps its conjuncts as std::set<Formula> internally. This set is ordered by Formula::Less and this ordering can be different from the one in inputs. Also, any duplicated formulas are removed in construction. Please check the following example.

// set up v1 = [y x y] and v2 = [1 2 1]
VectorX<Expression> v1{3};
VectorX<Expression> v2{3};
const Variable x{"x"};
const Variable y{"y"};
v1 << y, x, y;
v2 << 1, 2, 1;
// Here v1_eq_v2 = ((x = 2) ∧ (y = 1))
const Formula v1_eq_v2{v1 == v2};
const std::set<Formula> conjuncts{get_operands(v1_eq_v2)};
for (const Formula& f : conjuncts) {
std::cerr << f << std::endl;
}
// The outcome of the above loop is:
(x = 2)
(y = 1)

◆ operator>() [1/5]

Formula drake::symbolic::operator> ( const Expression e1,
const Expression e2 
)

◆ operator>() [2/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::ArrayXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() > typename DerivedB::Scalar()), Formula>, typename internal::RelationalOpTraits<DerivedA, DerivedB>::ReturnType> drake::symbolic::operator> ( const DerivedA &  a1,
const DerivedB &  a2 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using greater-than operator (>).

◆ operator>() [3/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename Derived::Scalar() > ScalarType()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator> ( const Derived &  a,
const ScalarType &  v 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using greater-than operator (>).

That is, for all i and j, the (i, j)-th entry of (a > v) has a symbolic formula a(i, j) > v.

◆ operator>() [4/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(ScalarType() > typename Derived::Scalar()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator> ( const ScalarType &  v,
const Derived &  a 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using less-than operator (<) instead of greater-than operator (>).

That is, for all i and j, the (i, j)-th entry of (v > a) has a symbolic formula a(i, j) < v.

Note that given v > a, this methods returns the result of a < v. First of all, this formulation is mathematically equivalent to the original formulation. We implement this method in this way to be consistent with Eigen's semantics. See the definition of EIGEN_MAKE_CWISE_COMP_R_OP in ArrayCwiseBinaryOps.h file in Eigen.

◆ operator>() [5/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::MatrixXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::MatrixXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() > typename DerivedB::Scalar()), Formula>, Formula> drake::symbolic::operator> ( const DerivedA &  m1,
const DerivedB &  m2 
)

Returns a symbolic formula representing element-wise comparison between two matrices m1 and m2 using greater-than operator (>).

The following table describes the return type of m1 > m2.

LHS \ RHS EM<Expression> EM<Variable> EM<double>
EM<Expression> Formula Formula Formula
EM<Variable> Formula Formula Formula
EM<double> Formula Formula N/A

In the table, EM is a short-hand of Eigen::Matrix.

◆ operator>=() [1/5]

Formula drake::symbolic::operator>= ( const Expression e1,
const Expression e2 
)

◆ operator>=() [2/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::ArrayXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() >= typename DerivedB::Scalar()), Formula>, typename internal::RelationalOpTraits<DerivedA, DerivedB>::ReturnType> drake::symbolic::operator>= ( const DerivedA &  a1,
const DerivedB &  a2 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison of two arrays a1 and a2 using greater-than-or-equal operator (>=).

◆ operator>=() [3/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(typename Derived::Scalar() >= ScalarType()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator>= ( const Derived &  a,
const ScalarType &  v 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between an array a and a scalar v using greater-than-or-equal operator (>=).

That is, for all i and j, the (i, j)-th entry of (a >= v) has a symbolic formula a(i, j) >= v.

◆ operator>=() [4/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::ArrayXpr> && std::is_same_v<decltype(ScalarType() >= typename Derived::Scalar()), Formula>, Eigen::Array<Formula, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> > drake::symbolic::operator>= ( const ScalarType &  v,
const Derived &  a 
)

Returns an Eigen array of symbolic formulas where each element includes element-wise comparison between a scalar v and an array using less-than-or-equal operator (<=) instead of greater-than-or-equal operator (>=).

That is, for all i and j, the (i, j)-th entry of (v >= a) has a symbolic formula a(i, j) <= v.

Note that given v >= a, this methods returns the result of a <= v. First of all, this formulation is mathematically equivalent to the original formulation. We implement this method in this way to be consistent with Eigen's semantics. See the definition of EIGEN_MAKE_CWISE_COMP_R_OP in ArrayCwiseBinaryOps.h file in Eigen.

◆ operator>=() [5/5]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<DerivedA>::XprKind, Eigen::MatrixXpr> && std::is_same_v<typename Eigen::internal::traits<DerivedB>::XprKind, Eigen::MatrixXpr> && std::is_same_v<decltype(typename DerivedA::Scalar() >= typename DerivedB::Scalar()), Formula>, Formula> drake::symbolic::operator>= ( const DerivedA &  m1,
const DerivedB &  m2 
)

Returns a symbolic formula representing element-wise comparison between two matrices m1 and m2 using greater-than-or-equal operator (>=).

The following table describes the return type of m1 >= m2.

LHS \ RHS EM<Expression> EM<Variable> EM<double>
EM<Expression> Formula Formula Formula
EM<Variable> Formula Formula Formula
EM<double> Formula Formula N/A

In the table, EM is a short-hand of Eigen::Matrix.

◆ operator||() [1/4]

Formula drake::symbolic::operator|| ( const Formula f1,
const Formula f2 
)

◆ operator||() [2/4]

Formula drake::symbolic::operator|| ( const Variable v,
const Formula f 
)

◆ operator||() [3/4]

Formula drake::symbolic::operator|| ( const Formula f,
const Variable v 
)

◆ operator||() [4/4]

Formula drake::symbolic::operator|| ( const Variable v1,
const Variable v2 
)

◆ PopulateRandomVariables()

Environment drake::symbolic::PopulateRandomVariables ( Environment  env,
const Variables variables,
RandomGenerator random_generator 
)

Populates the environment env by sampling values for the unassigned random variables in variables using random_generator.

◆ positive_semidefinite() [1/4]

Formula drake::symbolic::positive_semidefinite ( const Eigen::Ref< const MatrixX< Expression >> &  m)

Returns a symbolic formula constraining m to be a positive-semidefinite matrix.

By definition, a symmetric matrix m is positive-semidefinte if xᵀ m x ≥ 0 for all vector x ∈ ℝⁿ.

Exceptions
std::exceptionif m is not symmetric.
Note
This method checks if m is symmetric, which can be costly. If you want to avoid it, please consider using positive_semidefinite(m.triangularView<Eigen::Lower>()) or positive_semidefinite(m.triangularView<Eigen::Upper>()) instead of positive_semidefinite(m).

◆ positive_semidefinite() [2/4]

Formula drake::symbolic::positive_semidefinite ( const MatrixX< Expression > &  m,
Eigen::UpLoType  mode 
)

Constructs and returns a symbolic positive-semidefinite formula from m.

If mode is Eigen::Lower, it's using the lower-triangular part of m to construct a positive-semidefinite formula. If mode is Eigen::Upper, the upper-triangular part of m is used. It throws std::exception if has other values. See the following code snippet.

Eigen::Matrix<Expression, 2, 2> m;
m << 1.0, 2.0,
3.0, 4.0;
const Formula psd_l{positive_semidefinite(m, Eigen::Lower)};
// psd_l includes [1.0 3.0]
// [3.0 4.0].
const Formula psd_u{positive_semidefinite(m, Eigen::Upper)};
// psd_u includes [1.0 2.0]
// [2.0 4.0].

◆ positive_semidefinite() [3/4]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::MatrixXpr> && std::is_same_v<typename Derived::Scalar, Expression>, Formula> drake::symbolic::positive_semidefinite ( const Eigen::TriangularView< Derived, Eigen::Lower > &  l)

Constructs and returns a symbolic positive-semidefinite formula from a lower triangular-view l.

See the following code snippet.

Eigen::Matrix<Expression, 2, 2> m;
m << 1.0, 2.0,
3.0, 4.0;
Formula psd{positive_semidefinite(m.triangularView<Eigen::Lower>())};
// psd includes [1.0 3.0]
// [3.0 4.0].

◆ positive_semidefinite() [4/4]

std::enable_if_t< std::is_same_v<typename Eigen::internal::traits<Derived>::XprKind, Eigen::MatrixXpr> && std::is_same_v<typename Derived::Scalar, Expression>, Formula> drake::symbolic::positive_semidefinite ( const Eigen::TriangularView< Derived, Eigen::Upper > &  u)

Constructs and returns a symbolic positive-semidefinite formula from an upper triangular-view u.

See the following code snippet.

Eigen::Matrix<Expression, 2, 2> m;
m << 1.0, 2.0,
3.0, 4.0;
Formula psd{positive_semidefinite(m.triangularView<Eigen::Upper>())};
// psd includes [1.0 2.0]
// [2.0 4.0].

◆ pow() [1/6]

Monomial drake::symbolic::pow ( Monomial  m,
int  p 
)

Returns m raised to p.

Exceptions
std::exceptionif p is negative.

◆ pow() [2/6]

std::map<MonomialBasisElement, double> drake::symbolic::pow ( MonomialBasisElement  m,
int  p 
)

Returns m raised to p.

Note
that we return a map from the monomial power to its coefficient. This map has size 1, and the coefficient is also 1. We return a map instead of the MonomialBasisElement directly, because we want pow() to have the same return signature as other PolynomialBasisElement. For example, the power of a ChebyshevBasisElement object is a weighted sum of ChebyshevBasisElement objects.
Exceptions
std::exceptionif p is negative.

◆ pow() [3/6]

RationalFunction drake::symbolic::pow ( const RationalFunction f,
int  n 
)

Returns the rational function f raised to n.

If n is positive, (f/g)ⁿ = fⁿ / gⁿ; If n is negative, (f/g)ⁿ = g⁻ⁿ / f⁻ⁿ; (f/g)⁰ = 1 / 1.

◆ pow() [4/6]

Polynomial drake::symbolic::pow ( const Polynomial p,
int  n 
)

Returns polynomial p raised to n.

◆ pow() [5/6]

GenericPolynomialEnable<BasisElement> drake::symbolic::pow ( const GenericPolynomial< BasisElement > &  p,
int  n 
)

Returns polynomial raised to n.

Parameters
pThe base polynomial.
nThe exponent of the power.
Precondition
n>=0.

◆ pow() [6/6]

Expression drake::symbolic::pow ( const Expression e1,
const Expression e2 
)

◆ ReplaceBilinearTerms()

symbolic::Expression drake::symbolic::ReplaceBilinearTerms ( const symbolic::Expression e,
const Eigen::Ref< const VectorX< symbolic::Variable >> &  x,
const Eigen::Ref< const VectorX< symbolic::Variable >> &  y,
const Eigen::Ref< const MatrixX< symbolic::Expression >> &  W 
)

Replaces all the bilinear product terms in the expression e, with the corresponding terms in W, where W represents the matrix x * yᵀ, such that after replacement, e does not have bilinear terms involving x and y.

For example, if e = x(0)*y(0) + 2 * x(0)*y(1) + x(1) * y(1) + 3 * x(1), e has bilinear terms x(0)*y(0), x(0) * y(1) and x(2) * y(1), if we call ReplaceBilinearTerms(e, x, y, W) where W(i, j) represent the term x(i) * y(j), then this function returns W(0, 0) + 2 * W(0, 1) + W(1, 1) + 3 * x(1).

Parameters
eAn expression potentially contains bilinear products between x and y.
xThe bilinear product between x and y will be replaced by the corresponding term in W.
Exceptions
std::exceptionif x contains duplicate entries.
Parameters
yThe bilinear product between x and y will be replaced by the corresponding term in W. @throws std::exception ify` contains duplicate entries.
WBilinear product term x(i) * y(j) will be replaced by W(i, j). If W(i,j) is not a single variable, but an expression, then this expression cannot contain a variable in either x or y.
Exceptions
std::exception,ifW(i, j) is not a single variable, and also contains a variable in x or y.
Precondition
W.rows() == x.rows() and W.cols() == y.rows().
Returns
The symbolic expression after replacing x(i) * y(j) with W(i, j).

◆ sin()

Expression drake::symbolic::sin ( const Expression e)

◆ sinh()

Expression drake::symbolic::sinh ( const Expression e)

◆ sqrt()

Expression drake::symbolic::sqrt ( const Expression e)

◆ Substitute() [1/4]

Expression drake::symbolic::Substitute ( const Expression e,
const SinCosSubstitution subs 
)

Given a substitution map q => {s, c}, substitutes instances of sin(q) and cos(q) in e with s and c, with partial support for trigonometric expansions.

For instance,

  Variable x{"x"}, y{"y"};
  Variable sx{"sx"}, cx{"cx"}, sy{"sy"}, cy{"cy"};
  SinCosSubstitution subs;
  subs.emplace(x, SinCos(sx, cx));
  subs.emplace(y, SinCos(sy, cy));
  Expression e = Substitute(x * sin(x + y), subs);

will result in the expression x * (sx*cy + cx*sy).

Parameters
half_angleIf true, then the same workflow replaces instances of sin(q/2) and cos(q/2) in e will be replaced with s, and c.
Default: false.

The half-angle representation is more natural in many analysis computations for robots, for instance: https://underactuated.csail.mit.edu/lyapunov.html#trig_quadratic

Exceptions
std::exceptionif a trigonometric function is not a trigonometric polynomial in q or if the e requires a trigonometric expansion that not supported yet.

◆ Substitute() [2/4]

MatrixLikewise<Expression, Derived> drake::symbolic::Substitute ( const Eigen::MatrixBase< Derived > &  m,
const SinCosSubstitution subs 
)

Matrix version of sin/cos substitution.

◆ Substitute() [3/4]

MatrixLikewise<Expression, Derived> drake::symbolic::Substitute ( const Eigen::MatrixBase< Derived > &  m,
const Substitution subst 
)

Substitutes a symbolic matrix m using a given substitution subst.

Returns
a matrix of symbolic expressions whose size is the size of m.
Exceptions
std::exceptionif NaN is detected during substitution.

◆ Substitute() [4/4]

MatrixLikewise<Expression, Derived> drake::symbolic::Substitute ( const Eigen::MatrixBase< Derived > &  m,
const Variable var,
const Expression e 
)

Substitutes var with e in a symbolic matrix m.

Returns
a matrix of symbolic expressions whose size is the size of m.
Exceptions
std::exceptionif NaN is detected during substitution.

◆ SubstituteStereographicProjection()

symbolic::RationalFunction drake::symbolic::SubstituteStereographicProjection ( const symbolic::Polynomial e,
const std::vector< SinCos > &  sin_cos,
const VectorX< symbolic::Variable > &  t 
)

Substitutes the variables representing sine and cosine functions with their stereographic projection.

We replace cosθᵢ with (1-tᵢ²)/(1+tᵢ²), and sinθᵢ with 2tᵢ/(1+tᵢ²), and get a rational polynomial. The indeterminates of this rational polynomial are t together with the indeterminates in e that are not cosθ or sinθ. If the input expression doesn't contain the sine and cosine functions, then the returned rational has denominator being 1. Notice that the indeterminates of e can include variables other than cosθ and sinθ, and we impose no requirements on these variables that are not cosθ or sinθ.

Parameters
eThe symbolic polynomial to be substituted.
sin_cossin_cos(i) is the pair of variables (sᵢ, cᵢ), (where sᵢ=sinθᵢ, cᵢ=cosθᵢ) as documented above.
tNew variables to express cos and sin as rationals of t. tᵢ = tan(θᵢ/2).
Precondition
t.rows() == sin_cos.size()
Returns
e_rational The rational polynomial of e after replacement. The indeterminates of the polynomials are t together with the indeterminates in e that are not cosθ or sinθ. Example
* std::vector<SinCos> sin_cos;
* sin_cos.emplace_back(symbolic::Variable("s0"), symbolic::Variable("c0"));
* sin_cos.emplace_back(symbolic::Variable("s1"), symbolic::Variable("c1"));
* Vector2<symbolic::Variable> t(symbolic::Variable("t0"),
*                               symbolic::Variable("t1"));
* const auto e_rational =
* SubstituteStereographicProjection(t(0) * sin_cos[0].s*sin_cos[1].c + 1,
*                                   sin_cos, t);
* // e_rational should be
* // (2*t0*t0*(1-t1*t1) + (1+t0*t0)*(1+t1*t1))
* // --------------------------------------------
* //        ((1+t0*t0)*(1+t1*t1))
* 

◆ swap()

void drake::symbolic::swap ( Expression a,
Expression b 
)

◆ tan()

Expression drake::symbolic::tan ( const Expression e)

◆ tanh()

Expression drake::symbolic::tanh ( const Expression e)

◆ TaylorExpand()

Expression drake::symbolic::TaylorExpand ( const Expression f,
const Environment a,
int  order 
)

Returns the Taylor series expansion of f around a of order order.

Parameters
[in]fSymbolic expression to approximate using Taylor series expansion.
[in]aSymbolic environment which specifies the point of approximation. If a partial environment is provided, the unspecified variables are treated as symbolic variables (e.g. decision variable).
[in]orderPositive integer which specifies the maximum order of the resulting polynomial approximating f around a.

◆ to_conjunction()

std::shared_ptr<const FormulaAnd> drake::symbolic::to_conjunction ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaAnd>.

Precondition
is_conjunction(*f_ptr) is true.

◆ to_disjunction()

std::shared_ptr<const FormulaOr> drake::symbolic::to_disjunction ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaOr>.

Precondition
is_disjunction(*f_ptr) is true.

◆ to_equal_to()

std::shared_ptr<const FormulaEq> drake::symbolic::to_equal_to ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaEq>.

Precondition
is_equal_to(*f_ptr) is true.

◆ to_false()

std::shared_ptr<const FormulaFalse> drake::symbolic::to_false ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaFalse>.

Precondition
is_false(*f_ptr) is true.

◆ to_forall()

std::shared_ptr<const FormulaForall> drake::symbolic::to_forall ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaForall>.

Precondition
is_forall(*f_ptr) is true.

◆ to_greater_than()

std::shared_ptr<const FormulaGt> drake::symbolic::to_greater_than ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaGt>.

Precondition
is_greater_than(*f_ptr) is true.

◆ to_greater_than_or_equal_to()

std::shared_ptr<const FormulaGeq> drake::symbolic::to_greater_than_or_equal_to ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaGeq>.

Precondition
is_greater_than_or_equal_to(*f_ptr) is true.

◆ to_isnan()

std::shared_ptr<const FormulaIsnan> drake::symbolic::to_isnan ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaIsnan>.

Precondition
is_isnan(*f_ptr) is true.

◆ to_less_than()

std::shared_ptr<const FormulaLt> drake::symbolic::to_less_than ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaLt>.

Precondition
is_less_than(*f_ptr) is true.

◆ to_less_than_or_equal_to()

std::shared_ptr<const FormulaLeq> drake::symbolic::to_less_than_or_equal_to ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaLeq>.

Precondition
is_less_than_or_equal_to(*f_ptr) is true.

◆ to_nary()

std::shared_ptr<const NaryFormulaCell> drake::symbolic::to_nary ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const NaryFormulaCell>.

Precondition
is_nary(*f_ptr) is true.

◆ to_negation()

std::shared_ptr<const FormulaNot> drake::symbolic::to_negation ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaNot>.

Precondition
is_negation(*f_ptr) is true.

◆ to_not_equal_to()

std::shared_ptr<const FormulaNeq> drake::symbolic::to_not_equal_to ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaNeq>.

Precondition
is_not_equal_to(*f_ptr) is true.

◆ to_positive_semidefinite()

std::shared_ptr<const FormulaPositiveSemidefinite> drake::symbolic::to_positive_semidefinite ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaPositiveSemidefinite>.

Precondition
is_positive_semidefinite(*f_ptr) is true.

◆ to_relational()

std::shared_ptr<const RelationalFormulaCell> drake::symbolic::to_relational ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const RelationalFormulaCell>.

Precondition
is_relational(*f_ptr) is true.

◆ to_true()

std::shared_ptr<const FormulaTrue> drake::symbolic::to_true ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaTrue>.

Precondition
is_true(*f_ptr) is true.

◆ to_variable()

std::shared_ptr<const FormulaVar> drake::symbolic::to_variable ( const std::shared_ptr< const FormulaCell > &  f_ptr)

Casts f_ptr to shared_ptr<const FormulaVar>.

Precondition
is_variable(*f_ptr) is true.

◆ ToLatex() [1/4]

std::string drake::symbolic::ToLatex ( const Expression e,
int  precision = 3 
)

Generates a LaTeX string representation of e with floating point coefficients displayed using precision.

◆ ToLatex() [2/4]

std::string drake::symbolic::ToLatex ( const Formula f,
int  precision = 3 
)

Generates a LaTeX string representation of f with floating point coefficients displayed using precision.

◆ ToLatex() [3/4]

std::string drake::symbolic::ToLatex ( double  val,
int  precision = 3 
)

Generates a Latex string representation of val displayed with precision, with one exception.

If the fractional part of val is exactly zero, then val is represented perfectly as an integer, and is displayed without the trailing decimal point and zeros (in this case, the precision argument is ignored).

◆ ToLatex() [4/4]

std::string drake::symbolic::ToLatex ( const Eigen::PlainObjectBase< Derived > &  M,
int  precision = 3 
)

Generates a LaTeX string representation of M with floating point coefficients displayed using precision.

◆ uninterpreted_function()

Expression drake::symbolic::uninterpreted_function ( std::string  name,
std::vector< Expression arguments 
)

Constructs an uninterpreted-function expression with name and arguments.

An uninterpreted function is an opaque function that has no other property than its name and a list of its arguments. This is useful to applications where it is good enough to provide abstract information of a function without exposing full details. Declaring sparsity of a system is a typical example.

◆ VisitExpression()

Result drake::symbolic::VisitExpression ( Visitor *  v,
const Expression e,
Args &&...  args 
)

Calls visitor object v with a symbolic-expression e, and arguments args.

Visitor object is expected to implement the following methods which take f and args: VisitConstant, VisitVariable, VisitAddition, VisitMultiplication, VisitDivision, VisitLog, VisitAbs, VisitExp, VisitSqrt, VisitPow, VisitSin, VisitCos, VisitTan, VisitAsin, VisitAtan, VisitAtan2, VisitSinh, VisitCosh, VisitTanh, VisitMin, VisitMax, VisitCeil, VisitFloor, VisitIfThenElse, `VisitUninterpretedFunction.

Exceptions
std::exceptionif NaN is detected during a visit.

◆ VisitFormula()

Result drake::symbolic::VisitFormula ( Visitor *  v,
const Formula f,
Args &&...  args 
)

Calls visitor object v with a symbolic formula f, and arguments args.

Visitor object is expected to implement the following methods which take f and args: VisitFalse, VisitTrue, VisitVariable, VisitEqualTo, VisitNotEqualTo, VisitGreaterThan, VisitGreaterThanOrEqualTo, VisitLessThan, VisitLessThanOrEqualTo, VisitConjunction, VisitDisjunction, VisitNegation, VisitForall, VisitIsnan, VisitPositiveSemidefinite.

Check the implementation of NegationNormalFormConverter class in drake/common/test/symbolic_formula_visitor_test.cc file to find an example.

◆ VisitPolynomial()

Result drake::symbolic::VisitPolynomial ( Visitor *  v,
const Expression e,
Args &&...  args 
)

Calls visitor object v with a polynomial symbolic-expression e, and arguments args.

Visitor object is expected to implement the following methods which take f and args: VisitConstant, VisitVariable, VisitAddition, VisitMultiplication, VisitDivision, VisitPow.

Exceptions
std::exceptionif NaN is detected during a visit.

See the implementation of DegreeVisitor class and Degree function in drake/common/symbolic_monomial.cc as an example usage.

Precondition
e.is_polynomial() is true.