remainder

Contents

remainder#

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

Returns the element-wise remainder of division.

Computes the remainder complementary to the floor_divide function. It is equivalent to the Python modulus operator``x1 % x2`` and has the same sign as the divisor x2. The MATLAB function equivalent to np.remainder is mod.

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 x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

Returns:

out – The element-wise remainder of the quotient floor_divide(x1, x2). This is a scalar if both x1 and x2 are scalars.

This is a Quantity if division of x1 by x2 is not dimensionless.

Return type:

saiunit.Quantity | Array

Examples

>>> import saiunit as u
>>> a = [5, 6, 7] * u.second
>>> b = [2, 3, 4] * u.second
>>> u.math.remainder(a, b)