reciprocal

Contents

reciprocal#

class saiunit.math.reciprocal(x, **kwargs)#

Return the reciprocal of the argument, element-wise.

Calculates 1/x. When the input carries a unit, the result carries the inverse of that unit.

Parameters:

x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array.

Returns:

y – Return array with the same shape as x. This is a scalar if x is a scalar. This is a Quantity if the unit of x is not dimensionless; the resulting unit is 1 / x.unit.

Return type:

saiunit.Quantity | Array

Examples

>>> import saiunit as u
>>> result = u.math.reciprocal(u.math.array([2.0, 4.0]) * u.second)
>>> result.mantissa  # array([0.5 , 0.25])