square#
- class saiunit.math.square(x, **kwargs)#
Compute the square of each element.
When the input carries a unit, the resulting unit is the square of that unit (e.g.
meterbecomesmeter ** 2).- Parameters:
x (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – Input data.- Returns:
out – Element-wise
x * x, of the same shape and dtype as x. This is a scalar if x is a scalar. If x carries a unit, the result is a Quantity whose unit isx.unit ** 2.- Return type:
saiunit.Quantity |
Array
Examples
>>> import saiunit as u >>> q = u.math.array([2.0, 3.0, 4.0]) * u.meter >>> u.math.square(q) # Quantity with unit meter ** 2