Product¶
- class nodimo.product.Product(*factors: Quantity, name: str = '', dependent: bool = False, scaling: bool = False, reduce: bool = True)[source]¶
Product of quantities.
- Parameters:
- *quantitiesQuantity
Quantities to be multiplied.
- namestr, default=’’
Name (symbol) to be used as the product representation.
- dependentbool, default=False
If
True, the product is dependent.- scalingbool, default=False
If
True, the product can be used as scaling parameter.- reducebool, default=True
If
True, the product is simplified or rearranged.
- Attributes:
- factorslist[Quantity]
Multiplication factors.
Methods
reduce()
Turns an unreduced quantity into a reduced quantity.
- Raises:
- TypeError
If at least one of the factors is not a quantity.
Examples
>>> from nodimo import Quantity, Product >>> a = Quantity('a', A=-2, B=1) >>> b = Quantity('b', A=2, B=-1) >>> c = Product(a, b)
The
*operator can also be used to create a product:>>> d = a*b