Drake

Represents symbolic rational function. More...
#include <drake/common/symbolic_rational_function.h>
Public Member Functions  
RationalFunction ()  
Constructs a zero rational function 0 / 1. More...  
RationalFunction (const Polynomial &numerator, const Polynomial &denominator)  
Constructs the rational function: numerator / denominator. More...  
RationalFunction (const Polynomial &p)  
Constructs the rational function: p / 1. More...  
RationalFunction (double c)  
Constructs the rational function: c / 1. More...  
~RationalFunction ()=default  
const Polynomial &  numerator () const 
Getter for the numerator. More...  
const Polynomial &  denominator () const 
Getter for the denominator. More...  
RationalFunction &  operator+= (const RationalFunction &f) 
RationalFunction &  operator+= (const Polynomial &p) 
RationalFunction &  operator+= (double c) 
RationalFunction &  operator= (const RationalFunction &f) 
RationalFunction &  operator= (const Polynomial &p) 
RationalFunction &  operator= (double c) 
RationalFunction &  operator *= (const RationalFunction &f) 
RationalFunction &  operator *= (const Polynomial &p) 
RationalFunction &  operator *= (double c) 
RationalFunction &  operator/= (const RationalFunction &f) 
RationalFunction &  operator/= (const Polynomial &p) 
RationalFunction &  operator/= (double c) 
bool  EqualTo (const RationalFunction &f) const 
Returns true if this rational function and f are structurally equal. More...  
Formula  operator== (const RationalFunction &f) const 
Returns a symbolic formula representing the condition where this rational function and f are the same. More...  
Formula  operator!= (const RationalFunction &f) const 
Returns a symbolic formula representing the condition where this rational function and f are not the same. More...  
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable  
RationalFunction (const RationalFunction &)=default  
RationalFunction &  operator= (const RationalFunction &)=default 
RationalFunction (RationalFunction &&)=default  
RationalFunction &  operator= (RationalFunction &&)=default 
Friends  
std::ostream &  operator<< (std::ostream &, const RationalFunction &f) 
Represents symbolic rational function.
A function f(x) is a rational function, if f(x) = p(x) / q(x), where both p(x) and q(x) are polynomials of x. Note that rational functions are closed under (+, , x, /). One application of rational function is in polynomial optimization, where we represent (or approximate) functions using rational functions, and then convert the constraint f(x) = h(x) (where h(x) is a polynomial) to a polynomial constraint p(x)  q(x) * h(x) = 0, or convert the inequality constraint f(x) >= h(x) as p(x)  q(x) * h(x) >= 0 if we know q(x) > 0.
This class represents a special subset of the symbolic::Expression. While a symbolic::Expression can represent a rational function, extracting the numerator and denominator, generally, is quite difficult; for instance, from p1(x) / q1(x) + p2(x) / q2(x) + ... + pn(x) / qn(x). This class's explicit structure facilitates this decomposition.
RationalFunction  (  ) 
Constructs a zero rational function 0 / 1.

default 

default 
RationalFunction  (  const Polynomial &  numerator, 
const Polynomial &  denominator  
) 
Constructs the rational function: numerator / denominator.
numerator  The numerator of the fraction. 
denominator  The denominator of the fraction. 
std::logic_error  if the precondition is not satisfied. 

explicit 
Constructs the rational function: p / 1.
Note that we use 1 as the denominator.
p  The numerator of the rational function. 

explicit 
Constructs the rational function: c / 1.
Note that we use 1 as the denominator.
c  The numerator of the rational function. 

default 
const Polynomial& denominator  (  )  const 
Getter for the denominator.
bool EqualTo  (  const RationalFunction &  f  )  const 
Returns true if this rational function and f are structurally equal.
const Polynomial& numerator  (  )  const 
Getter for the numerator.
RationalFunction & operator *=  (  const RationalFunction &  f  ) 
RationalFunction & operator *=  (  const Polynomial &  p  ) 
RationalFunction & operator *=  (  double  c  ) 
Formula operator!=  (  const RationalFunction &  f  )  const 
Returns a symbolic formula representing the condition where this rational function and f
are not the same.
RationalFunction & operator+=  (  const RationalFunction &  f  ) 
RationalFunction & operator+=  (  const Polynomial &  p  ) 
RationalFunction & operator+=  (  double  c  ) 
RationalFunction & operator=  (  const RationalFunction &  f  ) 
RationalFunction & operator=  (  const Polynomial &  p  ) 
RationalFunction & operator=  (  double  c  ) 
RationalFunction & operator/=  (  const RationalFunction &  f  ) 
RationalFunction & operator/=  (  const Polynomial &  p  ) 
RationalFunction & operator/=  (  double  c  ) 

default 

default 
Formula operator==  (  const RationalFunction &  f  )  const 
Returns a symbolic formula representing the condition where this rational function and f
are the same.
If f1 = p1 / q1, f2 = p2 / q2, then f1 == f2 <=> p1 * q2 == p2 * q1

friend 