Symbolic expression representing an addition which is a sum of products.
\[ c_0 + \sum c_i * e_i \]
where \( c_i \) is a constant and \( e_i \) is a symbolic expression.
Internally this class maintains a member variable constant_ to represent \( c_0 \) and another member variable expr_to_coeff_map_ to represent a mapping from an expression \( e_i \) to its coefficient \( c_i \) of double. 
#include <drake/common/symbolic/expression/expression_cell.h>
Public Member Functions | |
| ExpressionAdd (double constant, std::map< Expression, double > expr_to_coeff_map) | |
Constructs ExpressionAdd from constant_term and term_to_coeff_map.  More... | |
| ~ExpressionAdd () override | |
| void | HashAppendDetail (DelegatingHasher *) const override | 
| Sends all hash-relevant bytes for this ExpressionCell type into the given hasher, per the hash_append generic hashing concept – except for get_kind(), because Expression already sends that.  More... | |
| Variables | GetVariables () const override | 
| Collects variables in expression.  More... | |
| bool | EqualTo (const ExpressionCell &e) const override | 
| Checks structural equality.  More... | |
| bool | Less (const ExpressionCell &e) const override | 
| Provides lexicographical ordering between expressions.  More... | |
| double | Evaluate (const Environment &env) const override | 
| Evaluates under a given environment (by default, an empty environment).  More... | |
| Expression | Expand () const override | 
| Expands out products and positive integer powers in expression.  More... | |
| Expression | EvaluatePartial (const Environment &env) const override | 
Returns an Expression obtained by replacing all occurrences of the variables in env in the current expression cell with the corresponding values in env.  More... | |
| Expression | Substitute (const Substitution &s) const override | 
Returns an Expression obtained by replacing all occurrences of the variables in s in the current expression cell with the corresponding expressions in s.  More... | |
| Expression | Differentiate (const Variable &x) const override | 
Differentiates this symbolic expression with respect to the variable var.  More... | |
| std::ostream & | Display (std::ostream &os) const override | 
Outputs string representation of expression into output stream os.  More... | |
| double | get_constant () const | 
| Returns the constant.  More... | |
| const std::map< Expression, double > & | get_expr_to_coeff_map () const | 
| Returns map from an expression to its coefficient.  More... | |
  Public Member Functions inherited from ExpressionCell | |
| virtual | ~ExpressionCell () | 
| std::atomic< int > & | use_count () const | 
| Returns the intrusive use count (ala boost::intrusive_ptr).  More... | |
| ExpressionKind | get_kind () const | 
| Returns expression kind.  More... | |
| bool | is_polynomial () const | 
| Checks if this symbolic expression is convertible to Polynomial.  More... | |
| bool | is_expanded () const | 
| Checks if this symbolic expression is already expanded.  More... | |
| void | set_expanded () | 
| Sets this symbolic expression as already expanded.  More... | |
| ExpressionCell (const ExpressionCell &)=delete | |
| ExpressionCell & | operator= (const ExpressionCell &)=delete | 
| ExpressionCell (ExpressionCell &&)=delete | |
| ExpressionCell & | operator= (ExpressionCell &&)=delete | 
Additional Inherited Members | |
  Protected Member Functions inherited from ExpressionCell | |
| ExpressionCell (ExpressionKind k, bool is_poly, bool is_expanded) | |
Constructs ExpressionCell of kind k with is_poly and is_expanded, with a use_count of zero.  More... | |
| ExpressionAdd | ( | double | constant, | 
| std::map< Expression, double > | expr_to_coeff_map | ||
| ) | 
Constructs ExpressionAdd from constant_term and term_to_coeff_map. 
      
  | 
  override | 
      
  | 
  overridevirtual | 
Differentiates this symbolic expression with respect to the variable var. 
| std::exception | if it is not differentiable. | 
Implements ExpressionCell.
      
  | 
  overridevirtual | 
Outputs string representation of expression into output stream os. 
Implements ExpressionCell.
      
  | 
  overridevirtual | 
Checks structural equality.
Implements ExpressionCell.
      
  | 
  overridevirtual | 
Evaluates under a given environment (by default, an empty environment).
| std::exception | if NaN is detected during evaluation. | 
Implements ExpressionCell.
      
  | 
  overridevirtual | 
Returns an Expression obtained by replacing all occurrences of the variables in env in the current expression cell with the corresponding values in env. 
| std::exception | if NaN is detected during substitution. | 
Implements ExpressionCell.
      
  | 
  overridevirtual | 
Expands out products and positive integer powers in expression.
| std::exception | if NaN is detected during expansion. | 
Implements ExpressionCell.
| double get_constant | ( | ) | const | 
Returns the constant.
| const std::map<Expression, double>& get_expr_to_coeff_map | ( | ) | const | 
Returns map from an expression to its coefficient.
      
  | 
  overridevirtual | 
Collects variables in expression.
Implements ExpressionCell.
      
  | 
  overridevirtual | 
Sends all hash-relevant bytes for this ExpressionCell type into the given hasher, per the hash_append generic hashing concept – except for get_kind(), because Expression already sends that.
Implements ExpressionCell.
      
  | 
  overridevirtual | 
Provides lexicographical ordering between expressions.
Implements ExpressionCell.
      
  | 
  overridevirtual | 
Returns an Expression obtained by replacing all occurrences of the variables in s in the current expression cell with the corresponding expressions in s. 
| std::exception | if NaN is detected during substitution. | 
Implements ExpressionCell.