friendlysam.opt.Mul¶
-
class
friendlysam.opt.Mul¶ Subtraction operator.
See
Operationfor a general description of operations.Parameters: *args – Should be exactly two terms to multiply. Examples
>>> x = VariableCollection('x') >>> expr = x(1) * x(2) >>> expr <friendlysam.opt.Mul at 0x...> >>> expr == Mul(x(1), x(2)) True >>> x(1).value, x(2).value = 2, 3 >>> float(expr) 6.0
Note
There is currently no division operator, but the operator
/is overloaded such thatx = a / bis equivalent tox = a * (1/b). Hence, you can do simple things like>>> print(x(1) / 4) x(1) * 0.25
Mul.create(*args) |
Classmethod to create a new object. |
Mul.evaluate([replace, evaluators]) |
Evaluate the expression recursively. |
Mul.args |
This property holds the arguments of the operation. |
Mul.leaves |
The leaves of the expression tree. |
Mul.value |
The concrete value of the expression, if possible. |
Mul.variables |
This property gives all leaves which are instances of Variable. |