power#
- class brainunit.math.power(x, y, **kwargs)#
First array elements raised to powers from second array, element-wise.
Raise each base in x to the positionally-corresponding power in y. The exponent y must be dimensionless. The resulting unit is
x.unit ** y.- Parameters:
x (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – The bases.y (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – The exponents. Must be dimensionless if a Quantity. Ifx.shape != y.shape, they must be broadcastable to a common shape.
- Returns:
out – The bases in x raised to the exponents in y. This is a scalar if both x and y are scalars. The resulting unit is
x.unit ** y.- Return type:
saiunit.Quantity |
Array- Raises:
TypeError – If y is a Quantity that is not dimensionless.
Examples
>>> import saiunit as u >>> q = u.math.array([2.0, 3.0]) * u.meter >>> u.math.power(q, 3) # unit is meter ** 3