square

square(x)

Try it yourself:

See also:

square(): Squaring a Number

square() returns a value multiplied by itself. Squaring produces nonnegative results for real inputs and is useful for distances, energies, variance, and error penalties.

Use and inverse

square(-3) is 9. Reverse a nonnegative squared quantity with sqrt(), noting that the original sign cannot be recovered. Use pow() for a variable exponent and dotPow() for element-wise array powers.

Large values grow quickly when squared, so keep an eye on overflow and units: squaring a length produces an area-like unit.

All functions