subtract

Contents

subtract#

class saiunit.math.subtract(x, y, **kwargs)#

Subtract arguments, element-wise.

Parameters:
  • x (Union[saiunit.Quantity, Array, ndarray, number, bool]) – The arrays to be subtracted from each other. If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

  • y (Union[saiunit.Quantity, Array, ndarray, number, bool]) – The arrays to be subtracted from each other. If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

Returns:

subtract – The difference of x and y, element-wise. This is a scalar if both x and y are scalars.

Return type:

Union[saiunit.Quantity, Array]

Examples

>>> import saiunit as u
>>> a = [4, 5, 6] * u.meter
>>> b = [1, 2, 3] * u.meter
>>> u.math.subtract(a, b)