friendlysam.opt.Add

class friendlysam.opt.Add

Addition operator.

See Operation for a general description of operations.

Parameters:*args – Should be exactly two terms to add.

Examples

>>> x = VariableCollection('x')
>>> expr = x(1) + x(2)
>>> expr
<friendlysam.opt.Add at 0x...>
>>> expr == Add(x(1), x(2))
True
>>> x(1).value, x(2).value = 2, 3
>>> float(expr)
5.0
Add.create(*args) Classmethod to create a new object.
Add.evaluate([replace, evaluators]) Evaluate the expression recursively.
Add.args This property holds the arguments of the operation.
Add.leaves The leaves of the expression tree.
Add.value The concrete value of the expression, if possible.
Add.variables This property gives all leaves which are instances of Variable.