square
A function that squares its argument.
Syntax

square(x)

x
is a number, vector, or matrix

Description

If
x
is a number,square(x)
is the square ofx
, equal tox⋅x = x^2
. 
If
v
is a vector,square(v)
is the dot product ofv
and itself, that is,v⋅v = (vv) = norm(v)^2
. 
If
A
is a square matrix,square(A)
is the square ofA
, that is,A⋅A = A^2
.
Notes
Typically, you write x^2
to square a number or matrix x
. However, if you need the squaring operation as a function, square
is more convenient to write than x ↦ x^2
.
Examples
square(5)
25
square(❨3, 0, −2❩)
13
square(❨❨2, 1❩, ❨i, 3❩❩)
⎛4 + i 5 ⎞ ⎝ 5⋅i 9 + i⎠
SequenceVector(20) @ square
(1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400)
SequenceVector(10) @ prime @ square
(4, 9, 25, 49, 121, 169, 289, 361, 529, 841)