sqrt

Contents

sqrt#

class brainunit.math.sqrt(x, **kwargs)#

Compute the positive square root of each element.

When the input carries a unit, the resulting unit is the square root of that unit (e.g. meter ** 2 becomes meter).

Parameters:

x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – The values whose square-roots are required.

Returns:

y – An array of the same shape as x, containing the positive square-root of each element. If x carries a unit, the result is a Quantity whose unit is x.unit ** 0.5.

Return type:

saiunit.Quantity | Array

Examples

>>> import saiunit as u
>>> q = u.math.array([4.0, 9.0, 16.0]) * (u.meter ** 2)
>>> u.math.sqrt(q)  # Quantity with unit meter