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.

Try Square in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions