divide

Contents

divide#

class brainunit.math.divide(x, y, **kwargs)#

Divide arguments element-wise.

The resulting unit is the quotient of the units of the two inputs.

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Dividend array.

  • y (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Divisor array. If x.shape != y.shape, they must be broadcastable to a common shape.

Returns:

out – The quotient of x and y, element-wise. This is a scalar if both x and y are scalars. The resulting unit is x.unit / y.unit.

Return type:

saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex

Examples

>>> import saiunit as u
>>> distance = u.math.array([10.0, 20.0]) * u.meter
>>> time = u.math.array([2.0, 4.0]) * u.second
>>> u.math.divide(distance, time)  # unit is meter / second