Power¶
- class nodimo.power.Power(base: Quantity, exponent: Number, name: str = '', dependent: bool = False, scaling: bool = False, reduce: bool = True)[source]¶
Power of a quantity.
- Parameters:
- baseQuantity
Quantity to be exponentiated.
- exponentNumber
Exponent to which the quantity will be raised.
- namestr, default=’’
Name (symbol) to be used as the power representation.
- dependentbool, default=False
If
True, the power is dependent.- scalingbool, default=False
If
True, the power can be used as scaling parameter.- reducebool, default=True
If
True, the exponentiation is simplified.
- Attributes:
- baseQuantity
Quantity that is the base of the exponentiation.
- exponentNumber
Exponent to which the quantity is raised.
Methods
reduce()
Turns an unreduced quantity into a reduced quantity.
- Raises:
- TypeError
If the exponentiation base is not a quantity.
Examples
>>> from nodimo import Quantity, Power >>> a = Quantity('a', A=-2, B=1) >>> b = Power(a, -2)
The
**operator can also be used to create a power:>>> c = a**3