add

Contents

add#

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

Add arguments element-wise.

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – The arrays to be added. If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

  • y (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – The arrays to be added. If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

Returns:

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

Return type:

saiunit.Quantity | Array

Examples

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