Linear Expression Module
========================
-This class implements linear expressions.
+This class implements linear expressions. A linear expression is….
+.. py:class:: Expression
+
+ .. py:method:: __new__(cls, coefficients=None, constant=0)
+
+ Create and return a new linear expression from a string or a list of coefficients and a constant.
+
.. py:method:: coefficient(self, symbol)
Return the coefficient value of the given symbol.
Return a list of the coefficients of an expression
- .. py:method:: constant(self)
+ .. attribute:: constant
Return the constant value of an expression.
- .. py:method:: symbols(self)
+ .. attribute:: symbols
Return a list of symbols in an expression.
- .. py:method:: dimension(self)
+ .. attribute:: dimension
+
+ Return the number of variables in an expression.
+
+ .. py:method:: isconstant(self)
+
+ Return ``True`` if an expression is a constant.
+
+ .. py:method:: issymbol(self)
+
+ Return ``True`` if an expression is a symbol.
+
+
+ .. py:method:: values(self)
+
+ Return the coefficient and constant values of an expression.
+
+ .. py:method:: __add__(self, other)
- Return the number of vriables in an expression.
+ Return the sum of *self* and *other*.
.. py:method:: __sub__(self, other)
- Return the difference between two expressions.
-
+ Return the difference between *self* and *other*.
+
+ .. py:method:: __mul__(self, other)
+
+ Return the product of *self* and *other* if *other* is a rational number.
+
+ .. py:method:: __eq__(self, other)
+
+ Test whether two expressions are equal.
+
+ .. py:method:: __le__(self, other)
+ self <= other
+
+ Create a new polyhedra from an expression with a single constraint as *self* less than or equal to *other*.
+
+ .. py:method:: __lt__(self, other)
+ self < other
+
+ Create a new polyhedra from an expression with a single constraint as *self* less than *other*.
+
+ .. py:method:: __ge__(self, other)
+ self >= other
+
+ Create a new polyhedra from an expression with a single constraint as *self* greater than or equal to *other*.
+
+ .. py:method:: __gt__(self, other)
+ self > other
+
+ Create a new polyhedra from an expression with a single constraint as *self* greater than *other*.
+
+ .. py:method:: scaleint(self)
+
+ Multiply an expression by a scalar to make all coefficients integer values.
+
.. py:method:: subs(self, symbol, expression=None)
Subsitute the given value into an expression and return the resulting expression.
+
+
+ .. py:method:: fromstring(self)
+
+ Create an expression from a string.
.. py:method:: fromsympy(self)
.. py:method:: tosympy(self)
Return an expression as a sympy object.
+
+.. py:class:: Symbol(Expression)
+
+ .. py:method:: __new__(cls, name)
+
+ Create and return a symbol from a string.
+
+ .. py:method:: symbols(names)
+
+ This function returns a sequence of symbols with names taken from names argument, which can be a comma or whitespace delimited string, or a sequence of strings.
+
+ .. py:method:: asdummy(self)
+
+ Return a symbol as a :class:`Dummy` Symbol.
.. py:class:: Dummy(Symbol)
-This class returns a dummy symbol to ensure that each no variables are repeated in an expression
+ This class returns a dummy symbol to ensure that no variables are repeated in an expression. This is useful when the user needs to have a unique symbol, for example as a temporary one in some calculation, which is going to be substituted for something else at the end anyway.
+
+ .. py:method:: __new__(cls, name=None)
+
+ Create and return a new dummy symbol.
+
+
+.. py:class:: Rational(Expression, Fraction)
+
+ This class represents integers and rational numbers of any size.
+
+ .. attribute:: constant
+
+ Return rational as a constant.
+
+ .. py:method:: isconstant(self)
+
+ Test whether a value is a constant.
+
+ .. py:method:: fromsympy(cls, expr)
+
+ Create a rational object from a sympy expression
+