square

square(x: array, /) array

Squares each element x_i of the input array x.

The square of a number x_i is defined as

\[x_i^2 = x_i \cdot x_i\]
Parameters:

x (array) – input array. Should have a numeric data type.

Returns:

out (array) – an array containing the evaluated result for each element in x. The returned array must have a data type determined by Type Promotion Rules.

Notes

Special cases

For floating-point operands, special cases must be handled as if the operation is implemented as x * x (see multiply()).

Changed in version 2022.12: Added complex data type support.